Skip to content
Source
Sign inSign up
TanStack/router

fix: revert "refactor: don't reparse upon navigation (#6398)" #6468

MergedSheraff(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/6468/headmerged by Sheraff(GitHub profile, opens in a new tab)

This reverts commit 6cbd96e357aa70b682154f3dba5f932186ce7d31.

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.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: react-router

    2. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: router-core

    3. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: history

    4. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: solid-router

    5. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: router-devtools-core

    6. github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: vue-router

    7. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      📝 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

      • TanStack/router#6398 — Main PR largely reverts the snapshot/NavigationResult/skipTransitionerLoad additions introduced in that PR, undoing navigation optimization logic.
      • TanStack/router#6252 — Directly related to the generated routeTree.fullPath changes for pathless layout routes; both address how layout route absolute paths are computed.
      • TanStack/router#4967 — Related changes to router-core's load/match async control flow and LoadFn signature simplification.

      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 nameStatusExplanationResolution
      Docstring Coverage⚠️ WarningDocstring 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 nameStatusExplanation
      Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
      Title check✅ PassedThe 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.
    8. nx-cloud[bot](GitHub profile, opens in a new tab)commented

      View your CI Pipeline Execution ↗ for commit aa6f71137eaf990f6bcd69fa70627e7942f321e8

      CommandStatusDurationResult
      nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded12m 50sView ↗
      nx run-many --target=build --exclude=examples/*...✅ Succeeded1m 47sView ↗

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

    9. Sheraff(GitHub profile, opens in a new tab) changed the title

    10. 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

    11. 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.

Sign in to join this conversation.