Skip to content

Conversation

@uhyo
Copy link
Owner

@uhyo uhyo commented Jan 24, 2026

Summary

  • Add a new requireChildren option to route definitions that controls whether a parent route can match when no children match
  • Default behavior is true (breaking change): parent routes now require at least one child to match
  • Setting requireChildren: false allows parent routes to match alone with outlet as null
  • This enables catch-all NotFound routes to work intuitively for unmatched nested URLs

Behavior

requireChildren No child matches Result
true (default) No match (falls through to next route)
false Parent has component Match parent, outlet=null
false Parent has no component No match

Test plan

  • Unit tests added for requireChildren option in matchRoutes.test.ts
  • Updated existing tests that relied on old behavior to use requireChildren: false
  • All tests pass (pnpm test:run)
  • Type checking passes (pnpm typecheck)

🤖 Generated with Claude Code

Add a new `requireChildren` option to route definitions that controls
whether a parent route can match when no children match.

- Default is `true` (breaking change): parent routes require a child
  to match, enabling catch-all NotFound pages to work intuitively
- Set to `false` to allow parent routes to match alone with outlet=null

This change makes route matching more predictable and allows catch-all
routes like `/*` to properly handle unmatched nested URLs.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@uhyo uhyo merged commit 60b7d26 into master Jan 24, 2026
1 check passed
@uhyo uhyo deleted the feat/require-children-option branch January 24, 2026 09:56
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.

2 participants