MCPcopy Create free account
hub / github.com/dailydotdev/apps / useShellRouteStack

Function useShellRouteStack

packages/shared/src/components/shell/shellNav.ts:291–305  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

289};
290
291export const useShellRouteStack = (): void => {
292 const router = useRouter();
293
294 // Once per tab: the router object changes on every route.
295 useEffect(() => {
296 recordShellRoute(window.location.pathname, historyKey(), documentArrival());
297 const onComplete = () =>
298 recordShellRoute(window.location.pathname, historyKey());
299 router.events.on('routeChangeComplete', onComplete);
300 return () => {
301 router.events.off('routeChangeComplete', onComplete);
302 };
303 // eslint-disable-next-line react-hooks/exhaustive-deps
304 }, []);
305};
306
307export const isSettingsPath = (pathname: string): boolean => {
308 const path = withoutLayoutVariantPrefix(pathname ?? '');

Callers 1

AppFunction · 0.90

Calls 4

recordShellRouteFunction · 0.85
historyKeyFunction · 0.85
documentArrivalFunction · 0.85
useRouterFunction · 0.50

Tested by

no test coverage detected