Skip to content

feat(router): support catch-all routes in ion-route - #31611

Merged
ShaneK merged 2 commits into
feature-9.1from
FW-6969
Oct 23, 2026
Merged

ShaneK merged 2 commits into
feature-9.1from
FW-6969

Conversation

@ShaneK

@ShaneK ShaneK commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Issue number: resolves #24726


What is the current behavior?

Currently, ion-router can't match an unknown path, so there's no way to render a "not found" page. A * in an ion-route url is matched literally, url="/:any" only catches a single segment, and an unknown path below a known route (e.g., /admin/settings) renders that route.

What is the new behavior?

An ion-route url that ends in * now matches any remaining path, and the matched part is passed to the component as pathMatch. Ranking follows React Router, so a catch-all only beats a route that matches the whole path when it has more fixed segments (/admin/* beats /:section/:id but not /admin/:id). It always beats a route that only matches by ignoring trailing segments. Apps without a * route match exactly as before.

Does this introduce a breaking change?

  • Yes
  • No

Not a breaking change, but a new feature, which is why it's in a feature branch.

Other information

This only affects vanilla JS and Stencil apps, since Angular, React and Vue use their own routers. The * in ion-route-redirect is unchanged, so from="/admin/*" still doesn't match /admin while url="/admin/*" does. The docs call out that difference (after the docs PR is merged).

Catch-all test page

Latest dev build

9.0.7-dev.11792524803.14f0e7d2

@ShaneK
ShaneK requested a review from a team as a code owner October 20, 2026 19:25
@ShaneK
ShaneK requested a review from brandyscarney October 20, 2026 19:25
@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ionic-framework Ready Ready Preview Oct 23, 2026 5:11pm UTC

Request Review

@brandyscarney brandyscarney left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Comment thread core/src/components/router/utils/matching.ts
Comment thread core/src/components/route-redirect/route-redirect.tsx Outdated
@ShaneK
ShaneK merged commit d70c578 into feature-9.1 Oct 23, 2026
55 checks passed
@ShaneK
ShaneK deleted the FW-6969 branch October 23, 2026 17:20

This branch was successfully deployed

1 active deployment
Preview — 41fdcf5d Deployed Oct 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants