Skip to content

Conversation

@schiller-manuel
Copy link
Contributor

@schiller-manuel schiller-manuel commented Jan 21, 2026

fixes #6435

Summary by CodeRabbit

  • Bug Fixes

    • Improved route parameter handling and extraction for navigation to paths with dynamic segments.
    • Enhanced navigation accuracy when transitioning to literal paths while preserving captured parameters.
  • Tests

    • Added test coverage for navigation to literal paths with parameter extraction validation.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

A new test case is added for literal path navigation, and the router-core introduces a MatchRoutesResult interface to expose raw string parameters captured during path matching alongside matched routes.

Changes

Cohort / File(s) Summary
Test Coverage
packages/react-router/tests/useNavigate.test.tsx
Adds new test case verifying navigation to literal path /auth/sign-in correctly extracts path parameters and updates location without explicit params object.
Route Matching Infrastructure
packages/router-core/src/router.ts
Introduces MatchRoutesResult interface (matches + rawParams), changes matchRoutesInternal return type from array to this new structure, updates all call sites to destructure and consume rawParams in location building logic.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • #5936 — Modifies router-core route-matching internals to introduce match results carrying raw/parsed params and updates buildLocation consumers.
  • #5135 — Modifies router-core's matchRoutesInternal and match building infrastructure in router.ts.
  • #5124 — Changes how route matching and parameter handling work within router-core.

Suggested labels

package: router-core, package: react-router

Suggested reviewers

  • Sheraff
  • nlynzaad

Poem

🐰 A hop, a skip, and params align,
Raw values captured, path by path so fine,
From '/auth/sign-in' the journey flows,
With MatchRoutesResult, our fix now shows! ✨
String literals sing, their secrets don't hide,
Navigation's complete on CSR's side! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: handle literal paths upon navigation' is clear, concise, and directly summarizes the main change—fixing how the router handles literal string paths during navigation.
Linked Issues check ✅ Passed The PR changes address issue #6435 by introducing MatchRoutesResult to preserve rawParams and updated snapshot construction logic, ensuring params extracted from URL segments populate correctly during CSR navigation with string literal paths.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing literal path navigation: new test case validates the fix, and router.ts changes implement rawParams preservation and snapshot construction updates required to resolve the issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link

nx-cloud bot commented Jan 21, 2026

View your CI Pipeline Execution ↗ for commit f045e7f

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 9m 42s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1m 46s View ↗

☁️ Nx Cloud last updated this comment at 2026-01-21 18:40:18 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 21, 2026

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@6440

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@6440

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@6440

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@6440

@tanstack/react-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@6440

@tanstack/react-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@6440

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@6440

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@6440

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@6440

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@6440

@tanstack/router-cli

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@6440

@tanstack/router-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@6440

@tanstack/router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@6440

@tanstack/router-devtools-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@6440

@tanstack/router-generator

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@6440

@tanstack/router-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@6440

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@6440

@tanstack/router-utils

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@6440

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@6440

@tanstack/solid-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@6440

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@6440

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-ssr-query@6440

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@6440

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@6440

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@6440

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@6440

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-fn-stubs@6440

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@6440

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@6440

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@6440

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@6440

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@6440

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@6440

@tanstack/vue-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router@6440

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router-devtools@6440

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router-ssr-query@6440

@tanstack/vue-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start@6440

@tanstack/vue-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-client@6440

@tanstack/vue-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-server@6440

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@6440

commit: f045e7f

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] params object is empty/undefined during CSR navigation with string literal paths in TanStack Start

2 participants