Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
35af8c8
reproduce matchRoute typed param failure
LadyBluenotes Jul 10, 2026
2471c1c
reproduce matchRoute typed param failures
LadyBluenotes Jul 10, 2026
22af4b8
enhance parameter parsing and matching with custom functions
LadyBluenotes Jul 10, 2026
24d14d8
ci: apply automated fixes
autofix-ci[bot] Jul 11, 2026
94c8373
changeset
LadyBluenotes Jul 11, 2026
f396cca
Merge branch 'match-route-parsed-params' of https://github.com/TanSta…
LadyBluenotes Jul 11, 2026
24a76d9
updates as per comments
LadyBluenotes Jul 11, 2026
06a3de5
refactor: replace findSingleMatch with findRouteMatch for improved pa…
LadyBluenotes Jul 11, 2026
df01347
update changeset
LadyBluenotes Jul 11, 2026
cbe3506
return parsed params from matchRoute
LadyBluenotes Jul 11, 2026
23c1da9
add brackets to make coderabbit happy
LadyBluenotes Jul 11, 2026
8363a29
Revert "return parsed params from matchRoute"
LadyBluenotes Jul 11, 2026
7dd0bab
reuse parsed route matches in matchRoute
LadyBluenotes Jul 12, 2026
c074b62
improve bundle sizes
LadyBluenotes Jul 12, 2026
4191e13
remove experiment
LadyBluenotes Jul 12, 2026
7ecd488
refactor: streamline parameter extraction and matching logic in Route…
LadyBluenotes Jul 12, 2026
c1f3318
ci: apply automated fixes
autofix-ci[bot] Jul 12, 2026
618b07f
add tests for reusing active matches and decoding fuzzy parameters
LadyBluenotes Jul 12, 2026
9276fdd
ci: apply automated fixes
autofix-ci[bot] Jul 12, 2026
6556dae
refactor: remove unused import for removeTrailingSlash in router.ts
LadyBluenotes Jul 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/plenty-jokes-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tanstack/router-core': patch
---

Fix `matchRoute` to respect parsed path parameters, route precedence, and exact trailing-slash matching.
38 changes: 38 additions & 0 deletions packages/react-router/tests/Matches.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,44 @@ test('should show pendingComponent of root route', async () => {
expect(await rendered.findByTestId('root-content')).toBeInTheDocument()
})

test('useMatchRoute matches typed params from routes with custom parse and stringify functions', async () => {
const rootRoute = createRootRoute()

function InvoiceComponent() {
const matchRoute = useMatchRoute()
const match = matchRoute({
to: '/invoices/$invoiceId',
params: { invoiceId: 123 },
})

return <div data-testid="match">{JSON.stringify(match)}</div>
}

const invoiceRoute = createRoute({
getParentRoute: () => rootRoute,
path: '/invoices/$invoiceId',
params: {
parse: ({ invoiceId }: { invoiceId: string }) => ({
invoiceId: Number(invoiceId),
}),
stringify: ({ invoiceId }: { invoiceId: number }) => ({
invoiceId: String(invoiceId),
}),
},
component: InvoiceComponent,
})
const router = createRouter({
routeTree: rootRoute.addChildren([invoiceRoute]),
history: createMemoryHistory({ initialEntries: ['/invoices/123'] }),
})

render(<RouterProvider router={router} />)

expect(await screen.findByTestId('match')).toHaveTextContent(
'{"invoiceId":123}',
)
})

describe('matching on different param types', () => {
const testCases = [
{
Expand Down
Loading
Loading