fix(client): consistent back navigation via goBackOr history-or-parent helper #310
No reviewers
Labels
No labels
area:auth
area:ci
area:db
area:infra
area:native
area:pwa
area:service
epic
feature
foundation
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
james/carol!310
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "308-back-nav-consistency"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Back affordances on the network detail screens used a bare
router.back(), which is a no-op on cold start, deep link, or web refresh — leaving the user stranded with no way back to the list.Fix
Adds
lib/nav/goBack.tsexportinggoBackOr(router, fallback): returns to the true previous screen when in-app history exists, otherwise replaces with the screen's logical parent.Audit (every back affordance in
apps/client)network/[id].tsx:268(person-detail Back)router.back()— no-op without historygoBackOr(router, "/network")network/orgs/[id].tsx:201(org-detail Back)router.back()— samegoBackOr(router, "/network")These two were the only true router back controls. Left unchanged (correctly):
experience.tsx"← Back to jobs/positions/contracts" — drive in-page sub-view state (setSelectedId(null)), not the router.router.replace("/network")in the delete handlers — you can't return to a just-deleted entity; the list is the right destination.router.replace(login/register/server-setup) and the sidebarChevronLeftcollapse toggle — not back-to-previous controls.Cross-navigation (org→person, person→org via
push) builds real history, sogoBackOrreturns to the actual originating detail screen; the/networkfallback only engages when there's genuinely no history.Conventions / verification
t("back")/t("organizationDetail.back")) — no copy changes.pnpm -F @carol/client typecheck— cleanpnpm -F @carol/client lint— cleanpnpm -F @carol/client test— 133 pass (addedtests/goBack.test.tscovering both branches)Closes #308
🤖 Generated with Claude Code
📊 Test coverage
Patch coverage: no testable lines changed.
Overall (
app/,lib/,db/, excluding UI per ADR-0019):Soft thresholds per ADR-0019. Coverage is informational and does not block merge.