Skip to content

Fix non-root initial route Back history - #159

Merged
artiphishle merged 9 commits into
mainfrom
agent/fix-non-root-initial-route-history
Jul 25, 2026
Merged

Fix non-root initial route Back history#159
artiphishle merged 9 commits into
mainfrom
agent/fix-non-root-initial-route-history

Conversation

@artiphishle

Copy link
Copy Markdown
Contributor

Fixes #158

Summary

  • generate non-root auth root redirects with Expo Router's withAnchor
  • keep the redirected destination as the initial Stack history entry instead of leaving / behind it
  • retain the canonical root redirect and auth bootstrap/protected-route boundary introduced by Fix generated auth root reload and bootstrap boundary #155
  • extend focused generation coverage for the root, app, and tabs initialRouteName chain
  • add a patch changeset

Root cause

For authenticated apps whose configured initial/post-sign-in route is non-root, the generated src/app/index.tsx redirected to /products without re-anchoring navigation. Entering through / could therefore leave an earlier Stack entry behind the Products screen and expose an erroneous Back button.

Expo Router supports withAnchor on Redirect specifically to replace the initial screen with the redirected route. The generated route now uses:

<Redirect href={'/products'} withAnchor />

Impact

  • opening / resolves to /products without an erroneous Back button
  • opening /products directly remains unchanged
  • nested routes retain normal Back navigation to their configured initial screen
  • no header is manually hidden; navigator history remains authoritative

Validation

Added focused Bun generation assertions covering:

  • anchored /products redirect generation
  • root Stack initial route (app)
  • authenticated app Stack initial route (tabs)
  • tabs initial route products
  • generated Products route placement

Full repository checks are left to CI because this change was authored through the connected GitHub environment rather than a local checkout.

@artiphishle artiphishle self-assigned this Jul 25, 2026
@artiphishle
artiphishle marked this pull request as ready for review July 25, 2026 08:45
@artiphishle
artiphishle merged commit 4f4b1a5 into main Jul 25, 2026
1 check passed
@artiphishle
artiphishle deleted the agent/fix-non-root-initial-route-history branch July 25, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Back button on non-root initial route opened through /

1 participant