Skip to content

Route-scoped useMatch ignores shouldThrow #8168

Closed

Description

@mizukendesu

Which project does this relate to?

Router

Describe the bug

Current route: /
Target route: /orgs/$orgId

Generic:

useMatch({
  from: '/orgs/$orgId',
  shouldThrow: false,
})

→ undefined

Route-scoped:

orgDetailRoute.useMatch({
  shouldThrow: false,
})

→ invariant error

Route-scoped useMatch drops shouldThrow while delegating to the standalone useMatch hook.

Complete minimal reproducer

https://github.com/mizukendesu/route-usematch-verify

Steps to Reproduce the Bug

  1. Clone the reproducer and run pnpm install
  2. Run pnpm dev:before
  3. Open /orgs/acme — both APIs return a match
  4. Navigate to Home — generic useMatch returns undefined, route-scoped useMatch throws

Expected behavior

undefined when the target route is inactive and shouldThrow is false.

Screenshots or Videos

Platform

  • Router / Start Version: 1.170.32
  • OS: macOS
  • Browser: Chrome
  • Bundler: vite
  • Bundler Version: 6.2.0

Additional context

Published @tanstack/react-router@1.170.32. The sidebar stays mounted on Home, so reading the child /orgs/$orgId match from that shell is optional.

Activity

  1. self-assigned this
    on Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions