Repository navigation
Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
v9.x
Current Behavior
When a page mounts in the same commit as a navigation, and the outlet has a catch-all
(*) route that matched the previous pathname, the new page is hidden. The screen is
blank. No error is thrown.
The entering page stays in the DOM like this:
<div class="ion-page ion-page-hidden" aria-hidden="true">…</div>A common trigger is logout: an anonymous-only route guard renders the login page as soon
as the user is cleared, and the logout handler calls navigateRoot('/login') in the same
tick.
Expected Behavior
The page for the new pathname is shown, as it is when the page mounts after the
navigation.
Steps to Reproduce
- Clone the reproduction, check out
register-stale-routeinfo, then run
npm installandnpm run dev. - Open
/join. The Join page is shown. - Press Log in. The app sets the user to logged in and calls
router.push('/verify', 'forward'). - Press Log out. The app calls
setLoggedIn(false), then
router.navigateRoot('/join'). - Observe: the screen is blank. The status bar at the bottom of the page reports
last: hidden. In the DOM, the Join page is in the innerion-router-outletwith
ion-page-hiddenandaria-hidden="true".
It reproduces on every logout (10/10 runs in Chromium). It does not depend on React
Router's v7_startTransition future flag: the result is the same with and without it.
The route shape is:
<IonRouterOutlet>
<Route path="/verify" element={<VerifyPage />} />
<Route path="*" element={
<Route path="/verify" element={<VerifyPage />} />
<Route path="*" element={
<IonPage>
<IonRouterOutlet>
<Route path="/join/*" element={<GuardAnonOnly><JoinPage /></GuardAnonOnly>} />
<Route path="*" element={<NotFoundPage />} />
</IonRouterOutlet>
</IonPage>
} />
</IonRouterOutlet>GuardAnonOnly renders its child only while logged out.
Code Reproduction URL
Ionic Info
Ionic:
Ionic CLI : 7.2.1 (/home/node/.npm/_npx/f6fddb685269761d/node_modules/@ionic/cli)
Ionic CLI : 7.2.1 (/home/node/.npm/_npx/f6fddb685269761d/node_modules/@ionic/cli)
Ionic Framework : @ionic/react 9.0.10
Capacitor:
Capacitor CLI : 8.0.0
@capacitor/android : not installed
@capacitor/core : 8.0.0
@capacitor/ios : not installed
Utility:
cordova-res : not installed globally
native-run : 2.0.1
System:
NodeJS : v26.13.0 (/usr/local/bin/node)
npm : 11.20.0
OS : Linux 6.18
Additional Information
I used AI (Opus 5.5) to prepare this issue report and reproduction.
Root cause
routeInfo trails the location. IonReactRouter passes a location change to
IonRouter from a useEffect, and IonRouter then calls setRouteInfo, which takes
another render. A page that mounts in the same commit as the navigation therefore calls
registerIonPage(page, routeInfo) with the previous pathname.
In the reproduction:
- While the user is on
/verify, the inner outlet (still mounted under the hidden*
page) has two view items:/join/*, whose page unmounted when the guard stopped
rendering it, and*, holdingNotFoundPagefor/verify. - On logout, the guard renders
JoinPagein the same commit as the navigation. The new
IonPageregisters withrouteInfo.pathname === '/verify'while the URL is already
/join. StackManager.registerIonPagecallsfindViewItemByRouteInfo(routeInfo, this.id). In
the inner outlet only the*route matches/verify, so the Join page becomes the*
view'sionPageElement, replacingNotFoundPage.- When
routeInforeaches/join,ReactRouterViewStack.renderViewItemdeactivates
the*view because the more specific/join/*route matches, and adds
@
the*view because the more specific/join/*route matches, and adds
ion-page-hiddenandaria-hidden="true"to that view'sionPageElement, which is
now the Join page. The/join/*view has no page element, so nothing is shown.
A trace of the lookups during logout (instrumented in the browser):
REG routerOutlet-4 [Join page] ri=/verify live=/join
FIND routerOutlet-4 ri=/verify -> * via StackManager.registerIonPage
FIND routerOutlet-4 ri=/join -> /join/* via StackManager.findViewItems
The existing orphaned-page check (shouldRejectOrphanedPage, from #28878) does not
apply: it compares data-pageid values and the outlet's own routeInfo, and here the
outlet's routeInfo is stale too.
Activity
thetaPC commentedon Nov 5, 2026
Thanks for the report.
Verified on 9.0.10.
IonPageregisters with Ionic's route info, which only updates in an effect after React Router's location changes. When the guard renders the Join page in the same commit asnavigateRoot('/join'), the page registers against/verify, so the inner outlet hands it to the*route that matched/verify. Once the route info reaches/join, the more specific/join/*route wins and the*view's page, which is now the Join page, gets hidden. Your trace is correct.Workaround, verified on 9.0.10 with and without
v7_startTransition: navigate first, then clear the user in a later task, so the guard renders the Join page after Ionic's route info has caught up:Tracked as a bug in
@ionic/react-router.fix(react-router): show page that mounts during a navigation (ionic-t…