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

Function canGoBackInApp

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

Source from the content-addressed store, hash-verified

343// of each client navigation in history.state, which the referrer (set once
344// per document) cannot tell after the first in-app move.
345export const canGoBackInApp = (): boolean => {
346 const { history } = globalThis;
347 if (!history || history.length <= 1) {
348 return false;
349 }
350 if (readStack().pointer > 0) {
351 return true;
352 }
353 const idx = (history.state as { idx?: number } | null)?.idx ?? 0;
354
355 return idx > 0 || isSameSiteReferrer() || isDevelopment;
356};
357
358// One back for every leaf: the previous entry when it is ours, otherwise
359// the root that owns the page, so a deep link always has a way up.

Callers 6

shellNav.spec.tsFile · 0.90
GoBackButtonFunction · 0.90
ConversationThreadFunction · 0.90
onBackFunction · 0.90
EditPostInComposerFunction · 0.90
useShellBackFunction · 0.85

Calls 2

readStackFunction · 0.85
isSameSiteReferrerFunction · 0.85

Tested by

no test coverage detected