Skip to content

Conversation

@Sheraff
Copy link
Contributor

@Sheraff Sheraff commented Jan 23, 2026

This reverts commit 6cbd96e.

Summary by CodeRabbit

Release Notes

  • New Features

    • Improved scroll restoration behavior with router-level flag management.
  • Bug Fixes

    • Corrected route path definitions across multiple examples.
    • Simplified navigation subscription logic to ensure consistent load behavior.
  • Breaking Changes

    • Router history methods now return void instead of promises.
    • Removed unused navigation options and types from public APIs.
  • Tests

    • Updated test timing and expectations to align with simplified navigation flow.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 23, 2026

📝 Walkthrough

Walkthrough

This PR removes snapshot-based route-matching optimizations and simplifies the navigation API across TanStack Router. Changes include eliminating NavigationResult, skipTransitionerLoad, and MatchSnapshot types; removing async return values from history push/replace; simplifying Transitioner implementations to always call router.load; adjusting route tree generated types for pathless layouts; and updating test expectations accordingly.

Changes

Cohort / File(s) Summary
Generated Route Tree Updates
e2e/react-router/basic-file-based-code-splitting/src/routeTree.gen.ts, e2e/react-router/basic-react-query-file-based/src/routeTree.gen.ts, e2e/vue-start/custom-basepath/src/routeTree.gen.ts
Updated FileRoutesByPath type declarations to change fullPath values: layout routes now use empty string '' instead of '/', and redirect routes normalized from trailing-slash to non-trailing-slash paths.
History API Simplification
packages/history/src/index.ts
Removed NavigationResult type, skipTransitionerLoad option, and navigateOpts parameter from subscribers. Changed RouterHistory.push and RouterHistory.replace return types from Promise<NavigationResult> to void. Removed TSR-specific fields from ParsedHistoryState.
Route Matching & Snapshot Removal
packages/router-core/src/router.ts
Eliminated snapshot-based fast-path logic: removed MatchSnapshot, MatchRoutesResult types and snapshot parameters from MatchRoutesOpts. Simplified matchRoutesInternal to return Array<AnyRouteMatch> directly. Updated LoadFn to remove _skipUpdateLatestLocation option. Added resetNextScroll field to RouterCore.
Location Type Cleanup
packages/router-core/src/location.ts, packages/router-core/src/index.ts
Removed exported MatchSnapshot and ValidatedSearchEntry interfaces. Removed _matchSnapshot field from ParsedLocation.
Scroll Restoration
packages/router-core/src/scroll-restoration.ts
Changed scroll reset logic from checking per-location __TSR_resetScroll state flag to checking router-level resetNextScroll flag.
Transitioner Updates
packages/react-router/src/Transitioner.tsx, packages/solid-router/src/Transitioner.tsx, packages/vue-router/src/Transitioner.tsx
Simplified history subscription callbacks to directly call router.load instead of conditionally checking navigateOpts.skipTransitionerLoad. Removed SubscriberArgs imports.
Test Updates - Navigation Timing
packages/react-router/tests/Matches.test.tsx, packages/react-router/tests/useNavigate.test.tsx, packages/solid-router/tests/link.test.tsx, packages/vue-router/tests/link.test.tsx
Removed await on history navigation calls and replaced waitFor blocks with direct assertions or findByTestId queries, loosening test timing constraints.
Test Updates - Expectations
packages/router-core/tests/load.test.ts, packages/vue-router/tests/store-updates-during-navigation.test.tsx
Removed microtask synchronization (Promise.resolve() awaits) and decremented expected update counts (28→27, 26→25, 23→22) in navigation tests.
DevTools Integration
packages/router-devtools-core/src/BaseTanStackRouterDevtoolsPanel.tsx
Added resetNextScroll to the exclusion list for explorer state property mapping.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Suggested reviewers

  • schiller-manuel
  • chorobin
  • nlynzaad

Poem

🐰 The snapshots fade, the paths grow clear,
No more Promise chains, just loads sincere!
Layout routes stripped to empty strings,
A lighter router now has wings! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: reverting a previous refactor commit. It is clear, specific, and directly related to the changeset contents.

✏️ 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 23, 2026

View your CI Pipeline Execution ↗ for commit aa6f711

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

☁️ Nx Cloud last updated this comment at 2026-01-23 15:23:40 UTC

@Sheraff Sheraff changed the title Revert "refactor: don't reparse upon navigation (#6398)" fix: revert "refactor: don't reparse upon navigation (#6398)" Jan 23, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 23, 2026

More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: aa6f711

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/router-core/src/router.ts (1)

700-706: Guard parsedParams when skipRouteOnParseError is enabled.

parsedParams is now optional, but key in parsedParams! will throw if it’s undefined. This can surface as a runtime error during matching when skipRouteOnParseError is used. Please guard with a fallback object (or default it in getMatchedRoutes).

🐛 Proposed fix
-    const { foundRoute, routeParams, parsedParams } = matchedRoutesResult
+    const { foundRoute, routeParams, parsedParams } = matchedRoutesResult
+    const safeParsedParams = parsedParams ?? {}

...
-          for (const key in usedParams) {
-            if (key in parsedParams!) {
-              strictParams[key] = parsedParams![key]
-            }
-          }
+          for (const key in usedParams) {
+            if (key in safeParsedParams) {
+              strictParams[key] = (safeParsedParams as any)[key]
+            }
+          }

Also applies to: 1266-1558, 2781-2787

♻️ Duplicate comments (2)
packages/react-router/tests/useNavigate.test.tsx (2)

1450-1465: Same sync-assumption as earlier segment.
No additional notes beyond the verification about immediate router state assertions above.


1763-1778: Same sync-assumption as earlier segment.
No additional notes beyond the verification about immediate router state assertions above.

@Sheraff Sheraff merged commit f054c0c into main Jan 23, 2026
6 checks passed
@Sheraff Sheraff deleted the revert-back-nav-snapshots branch January 23, 2026 15:50
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.

2 participants