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

Function readStack

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

Source from the content-addressed store, hash-verified

167const emptyStack = (): RouteStack => ({ routes: [], pointer: -1 });
168
169const readStack = (): RouteStack => {
170 try {
171 const parsed = JSON.parse(
172 globalThis.sessionStorage?.getItem(stackKey) ?? 'null',
173 ) as RouteStack | null;
174 if (
175 parsed &&
176 Array.isArray(parsed.routes) &&
177 parsed.routes.every((entry) => typeof entry?.key === 'string')
178 ) {
179 return parsed;
180 }
181 } catch {
182 // fall through to an empty stack
183 }
184 return emptyStack();
185};
186
187const writeStack = (stack: RouteStack) => {
188 try {

Callers 4

recordShellRouteFunction · 0.85
goBackPastFunction · 0.85
previousShellPathFunction · 0.85
canGoBackInAppFunction · 0.85

Calls 1

emptyStackFunction · 0.85

Tested by

no test coverage detected