docs(mobile): document the two per-route reset contracts

Both exported helpers exist for a non-obvious reason — they must be re-created or
re-derived per worktree, or a reused route inherits the previous workspace's
hydration state and the resurrection guard silently disarms.
This commit is contained in:
Brennan Benson
2026-07-29 16:31:13 -07:00
parent c0beda000c
commit 216f1d49a4
@@ -6,6 +6,10 @@ type InitialSessionTerminalAutoCreateState = {
sawSessionTabs: boolean
}
/**
* Fresh auto-create bookkeeping. The route must re-create this on every worktree
* change, or a revisit inherits the previous workspace's `sawSessionTabs`.
*/
export function createInitialSessionAutoCreateState(): InitialSessionTerminalAutoCreateState {
return { autoCreatedForWorktree: null, sawSessionTabs: false }
}
@@ -81,6 +85,10 @@ export function useInitialSessionTerminalAutoCreate(
])
}
/**
* Tracks "tabs hydrated" per worktree so a reused route reports `false` until the
* new workspace's own snapshot lands, rather than inheriting the old one's.
*/
export function useWorktreeSessionTabsLoaded(
worktreeId: string
): readonly [boolean, (loaded: boolean) => void] {