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

Function useShellRouteStack

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

Source from the content-addressed store, hash-verified

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