Skip to content

fix(vue): skip transitions for superseded pages - #31570

Open
hendriksenremco wants to merge 1 commit into
ionic-team:mainfrom
hendriksenremco:vue-skip-superseded-page-transition
Open

hendriksenremco wants to merge 1 commit into
ionic-team:mainfrom
hendriksenremco:vue-skip-superseded-page-transition

Conversation

@hendriksenremco

Copy link
Copy Markdown

Issue number: resolves #31569


What is the current behavior?

When a page in IonRouterOutlet mounts its <ion-page> after the route has already moved on to a newer page, its registerCallback still calls handlePageTransition(). That function reads the current route, so it runs the transition for the newer page, which has no ion-page yet. This logs the missing <ion-page> warning and throws TypeError: Cannot read properties of undefined (reading 'classList') in isViewVisible.

What is the new behavior?

  • The registerCallback looks up the view item for the current route first. It only runs the transition when that item is the entering item, or when that item has no pending registerCallback.
  • A superseded page that registers late no longer runs the transition for the newer page. The newer page runs its own transition once its ion-page registers.
  • All other cases keep the existing behavior. That includes a newer page that has already registered, or a route that has no view item in this outlet.
  • Adds a unit test in routing.spec.ts: two async pages, navigating to both before either loads, and loading the first one before the second.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Testing:

  • packages/vue: npm run lint, npm run typecheck and npm run build pass, with no diff after lint.
  • Vue test app (vue3), npm run test:unit: 74 tests pass. The new test fails without the fix with the TypeError above.
  • Cypress and Playwright e2e were not run locally.
  • We run the same change in our production app (Nuxt + Capacitor + IonRouterOutlet) via a local yarn patch on @ionic/vue 8.8.5.

This PR was written with Claude Code.

🤖 Generated with Claude Code

A page that mounted its ion-page after the route had moved on to a newer
page ran the transition for that newer page. The newer page had no
ion-page yet, so the transition threw a TypeError.

Only run the transition from the register callback when the view item
for the current route is the entering item, or when that item has no
pending register callback. The newer page runs its own transition once
it registers.

closes ionic-team#31569

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hendriksenremco
hendriksenremco requested a review from a team as a code owner October 14, 2026 10:24
@vercel

vercel Bot commented Oct 14, 2026

Copy link
Copy Markdown

@hendriksenremco is attempting to deploy a commit to the Ionic Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the package: vue @ionic/vue package label Oct 14, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: vue @ionic/vue package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: vue router outlet throws when a superseded page mounts after the route moved on

1 participant