Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

13 linesCodeBlameRaw
1/** A page's automatic work cannot override a newer navigation or a later visit. */
2export function pageOwnsNavigation(state: { location: { key: string }; navigation: { state: string } }, key: string): boolean {
3 return state.location.key === key && state.navigation.state === "idle";
4}
5
6/** Compare navigation identities, not just paths: a repeat click is a new attempt. */
7export function pendingNavigationOwns(state: { state: string; location?: { key: string } }, key: string | undefined): boolean {
8 return key !== undefined && state.state === "loading" && state.location?.key === key;
9}
10
11export function sidebarLocation<T>(state: { location: T; navigation: { location?: T } }): T {
12 return state.navigation.location ?? state.location;
13}