Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

routeReveal.ts

24 lines862 Bytes

1// AppSidebarLayout owns this so drawer and Settings remounts preserve the chosen project scope.
2// Only route changes may widen that scope; scroll position is lost on remount.
3// Leaving Settings commits the router's location before its matches, briefly hiding thread params.
4// Ignore null keys so the same thread does not look new during that gap.
5export interface SidebarRouteReveal {
6 observedKey: string | null;
7 pendingKey: string | null;
8}
9​
10export function pendingSidebarRouteReveal(
11 reveal: SidebarRouteReveal,
12 routeKey: string | null,
13): string | null {
14 if (routeKey === null) return null;
15 if (reveal.observedKey !== routeKey) {
16 reveal.observedKey = routeKey;
17 reveal.pendingKey = routeKey;
18 }
19 return reveal.pendingKey;
21​
22export function completeSidebarRouteReveal(reveal: SidebarRouteReveal): void {
23 reveal.pendingKey = null;