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

Function canGoBackInApp

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

Source from the content-addressed store, hash-verified

346// of each client navigation in history.state, which the referrer (set once
347// per document) cannot tell after the first in-app move.
348export const canGoBackInApp = (): boolean => {
349 const { history } = globalThis;
350 if (!history || history.length <= 1) {
351 return false;
352 }
353 if (readStack().pointer > 0) {
354 return true;
355 }
356 const idx = (history.state as { idx?: number } | null)?.idx ?? 0;
357
358 return idx > 0 || isSameSiteReferrer() || isDevelopment;
359};
360
361// One back for every leaf: the previous entry when it is ours, otherwise
362// 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