Files
hapi/web/src/lib/sessionNavigation.ts
T
AnanovoandGitHub ec19699418 fix(web): preserve session sidebar scroll during navigation (#1552)
* fix(web): preserve session sidebar scroll during navigation

* fix(web): preserve nested session pane scroll

* fix(web): avoid repeated file scroll restoration

* fix(web): preserve scroll when leaving chat file previews

* fix(web): preserve scroll after session resolution
2026-08-16 22:39:07 +08:00

17 lines
653 B
TypeScript

// The /sessions layout keeps its sidebar mounted while its child route changes.
// TanStack Router restores every scrollable element by default, so a cached child
// route can otherwise overwrite the sidebar's current scrollTop. The child panes
// own their own scroll state; internal workspace navigation should skip the
// router-wide restoration pass.
export const PRESERVE_SESSION_SIDEBAR_SCROLL = {
resetScroll: false,
} as const
export function getSessionListSelectionNavigation(sessionId: string) {
return {
to: '/sessions/$sessionId' as const,
params: { sessionId },
...PRESERVE_SESSION_SIDEBAR_SCROLL,
}
}