Problem
After #159, opening the Nutrition Scanner app through the Studio dashboard at / resolves to /products, but the Products screen still displays a Back button. The navigation also carries an initial=false parameter.
This is not the desired behavior:
/ should resolve to the authenticated post-sign-in route /products
/products must be the effective root entry and must not show a Back button
- no
initial=false workaround or navigation parameter should be required
- deeper routes should retain normal Back navigation to
/products
Root cause
Generated auth apps currently have two owners for the root transition:
src/app/index.tsx is generated with a redirect to the non-root post-sign-in route.
- The generated root layout also performs the authenticated
/ → post-sign-in transition with router.replace(...) after auth bootstrap.
The redirect introduced by #159 uses withAnchor. Expo Router anchoring and initialRouteName are intended to reconstruct navigator history for deep links. In this flow that can create synthetic previous navigation state and expose a Back button, rather than making /products the true root entry.
Using initial=false only suppresses part of that behavior at the navigation call site and leaves the competing ownership unresolved.
Proposed solution
Make the generated root layout the sole owner of auth bootstrap and root canonicalization.
Generator
For apps with global auth enabled:
- do not generate
src/app/index.tsx solely to redirect to postSignInRoute
- remove the generated
Redirect / withAnchor path for this case
- keep the existing auth-ready boundary in the root layout
- after auth is ready, use
router.replace(AUTH_POST_SIGN_IN_ROUTE_TARGET) when an authenticated user enters /
Navigator structure
Keep natural navigator initial routes:
- root Stack initial route:
(app)
- authenticated app Stack initial route:
(tabs)
- tabs initial route:
products
Do not pass or generate initial=false as a workaround.
Expected behavior
Enter through Studio dashboard
Dashboard opens /
→ root layout bootstraps auth
→ authenticated root canonicalization replaces / with /products
→ Products is the effective root screen
→ no Back button
Direct route
/products
→ Products is the initial screen
→ no Back button
Nested route
/products/:id
→ normal navigation history back to /products
→ Back button is shown
Acceptance criteria
Regression coverage
Add generator assertions that:
- no
src/app/index.tsx redirect is generated for an auth app whose post-sign-in route is products
- the root layout owns the authenticated
/ replacement
- the root, app, and tabs
initialRouteName chain remains correct
Add a web integration/E2E test that:
- prepares an authenticated session
- opens
/
- waits for
/products
- verifies no Back button and no
initial parameter
- opens a nested Product route
- verifies Back returns to
/products
Context
Follow-up to #158 and #159. The goal is navigator-owned history with a single root-navigation owner, not header hiding or an initial=false hack.
Problem
After #159, opening the Nutrition Scanner app through the Studio dashboard at
/resolves to/products, but the Products screen still displays a Back button. The navigation also carries aninitial=falseparameter.This is not the desired behavior:
/should resolve to the authenticated post-sign-in route/products/productsmust be the effective root entry and must not show a Back buttoninitial=falseworkaround or navigation parameter should be required/productsRoot cause
Generated auth apps currently have two owners for the root transition:
src/app/index.tsxis generated with a redirect to the non-root post-sign-in route./→ post-sign-in transition withrouter.replace(...)after auth bootstrap.The redirect introduced by #159 uses
withAnchor. Expo Router anchoring andinitialRouteNameare intended to reconstruct navigator history for deep links. In this flow that can create synthetic previous navigation state and expose a Back button, rather than making/productsthe true root entry.Using
initial=falseonly suppresses part of that behavior at the navigation call site and leaves the competing ownership unresolved.Proposed solution
Make the generated root layout the sole owner of auth bootstrap and root canonicalization.
Generator
For apps with global auth enabled:
src/app/index.tsxsolely to redirect topostSignInRouteRedirect/withAnchorpath for this caserouter.replace(AUTH_POST_SIGN_IN_ROUTE_TARGET)when an authenticated user enters/Navigator structure
Keep natural navigator initial routes:
(app)(tabs)productsDo not pass or generate
initial=falseas a workaround.Expected behavior
Enter through Studio dashboard
Direct route
Nested route
Acceptance criteria
postSignInRoutedo not generate a synthetic root redirect screen./while authenticated ends at/productswith no Back button./productsdirectly has the same navigation state and no Back button.initial=falseor another navigation-history workaround./products.Regression coverage
Add generator assertions that:
src/app/index.tsxredirect is generated for an auth app whose post-sign-in route isproducts/replacementinitialRouteNamechain remains correctAdd a web integration/E2E test that:
//productsinitialparameter/productsContext
Follow-up to #158 and #159. The goal is navigator-owned history with a single root-navigation owner, not header hiding or an
initial=falsehack.