wealth/docs/decisions/0038-back-resolution-and-de...

18 lines
1.2 KiB
Markdown

# 0038 Back follows the page's declared parent, never the browser alone
Status: Superseded by 0057 · Area: architecture · Date: 2026-10-09 · Decided by: agent
## Context
The new design's R14 rule: every page opened from another page has back on mobile and desktop, because an installed PWA has no browser bar. Roots (خانه, جستجو, the dashboards, a creator's own channel) have none. `history.back()` alone fails on a deep link or a notification tap.
## Decision
- Back resolves in this order: `onBack` → a target a client part declared with `useBackTarget` → the page's `href` → in-app history (Navigation API `canGoBack`, else `history.length`) → `parentHref` → home.
- Mobile bars take `backHref` (fixed) and `parentHref` (used when no page of this site is behind it). Desktop non-root columns show `DeskBack` («بازگشت») above the page title; `DesktopPageTitle` renders it.
- A page opened from a link or notice returns to its parent; the payment result returns to the channel, never the bank.
## Alternatives
- Browser history only: a deep link's back leaves the site or does nothing in the PWA.
## Consequences
Every new pushed page passes `parentHref`; roots pass nothing.