fix: revert "refactor: don't reparse upon navigation (#6398)" #6468
main fromrefs/pull/6468/head·merged 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.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: react-router
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: router-core
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: history
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: solid-router
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: router-devtools-core
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: vue-router
View your CI Pipeline Execution ↗ for commit aa6f71137eaf990f6bcd69fa70627e7942f321e8
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:40UTCSheraff(GitHub profile, opens in a new tab) changed the title
More templates
- tanstack-router-vue-example-basic-jsx
- tanstack-router-vue-example-basic-file-based-jsx
- tanstack-router-vue-example-basic-file-based-sfc
- tanstack-router-react-example-authenticated-routes
- tanstack-router-react-example-authenticated-routes-firebase
- tanstack-router-react-example-basic
- tanstack-router-react-example-basic-default-search-params
- tanstack-router-react-example-basic-devtools-panel
- tanstack-router-react-example-basic-file-based
- tanstack-router-react-example-basic-non-nested-devtools
- tanstack-router-react-example-react-query
- tanstack-router-react-example-basic-react-query-file-based
- tanstack-router-react-example-basic-ssr-file-based
- tanstack-router-react-example-basic-ssr-streaming-file-based
- tanstack-router-react-example-basic-virtual-file-based
- tanstack-router-react-example-basic-virtual-inside-file-based
- tanstack-router-react-example-deferred-data
- tanstack-router-i18n-paraglide
- tanstack-router-react-example-kitchen-sink
- tanstack-router-react-example-kitchen-sink-file-based
- tanstack-router-react-example-kitchen-sink-react-query
- tanstack-router-react-example-kitchen-sink-react-query-file-based
- tanstack-router-react-example-large-file-based
- tanstack-router-react-example-location-masking
- tanstack-router-react-example-navigation-blocking
- tanstack-router-react-example-quickstart
- tanstack-router-react-example-quickstart-esbuild-file-based
- tanstack-router-react-example-quickstart-file-based
- tanstack-router-react-example-quickstart-rspack-file-based
- tanstack-router-react-example-quickstart-webpack-file-based
- router-monorepo-react-query
- router-mono-simple
- router-mono-simple-lazy
- tanstack-router-react-example-scroll-restoration
- tanstack-search-validator-adapters
- tanstack-start-example-bare
- tanstack-start-example-basic
- tanstack-start-example-basic-auth
- tanstack-router-react-example-basic-authjs
- tanstack-start-example-basic-cloudflare
- tanstack-start-example-basic-react-query
- tanstack-start-example-basic-rsc
- tanstack-start-example-basic-static
- tanstack-start-bun-hosting
- tanstack-start-example-clerk-basic
- tanstack-start-example-convex-trellaux
- tanstack-start-example-counter
- tanstack-start-i18n-paraglide
- tanstack-start-example-large
- tanstack-start-example-material-ui
- tanstack-start-streaming-data-from-server-functions
- tanstack-start-example-supabase-basic
- tanstack-start-tailwind-v4
- tanstack-start-example-trellaux
- tanstack-start-example-workos
- tanstack-router-react-example-view-transitions
- tanstack-router-react-example-with-framer-motion
- tanstack-router-react-example-with-trpc
- tanstack-router-react-example-with-trpc-react-query
- tanstack-router-solid-example-authenticated-routes
- tanstack-router-solid-example-authenticated-routes-firebase
- tanstack-router-solid-example-basic
- tanstack-router-solid-example-basic-default-search-params
- tanstack-router-solid-example-basic-devtools-panel
- tanstack-router-solid-example-basic-file-based
- tanstack-router-solid-example-basic-non-nested-devtools
- tanstack-router-solid-example-basic-solid-query
- tanstack-router-solid-example-basic-solid-query-file-based
- tanstack-router-solid-example-basic-ssr-file-based
- tanstack-router-solid-example-basic-ssr-streaming-file-based
- tanstack-router-solid-example-basic-virtual-file-based
- tanstack-router-solid-example-basic-virtual-inside-file-based
- tanstack-router-solid-example-deferred-data
- tanstack-router-solid-i18n-paraglide
- tanstack-router-solid-example-kitchen-sink
- tanstack-router-solid-example-kitchen-sink-file-based
- tanstack-router-solid-example-kitchen-sink-solid-query
- tanstack-router-solid-example-kitchen-sink-solid-query-file-based
- tanstack-router-solid-example-large-file-based
- tanstack-router-solid-example-location-masking
- tanstack-router-solid-example-navigation-blocking
- tanstack-router-solid-example-quickstart
- tanstack-router-solid-example-quickstart-esbuild-file-based
- tanstack-router-solid-example-quickstart-file-based
- tanstack-router-solid-example-quickstart-rspack-file-based
- tanstack-router-solid-example-quickstart-webpack-file-based
- @tanstack/router-solid-mono-simple
- router-solid-mono-simple-lazy
- router-solid-monorepo-solid-query
- tanstack-router-solid-example-scroll-restoration
- tanstack-solid-router-search-validator-adapters
- tanstack-solid-start-example-basic
- tanstack-solid-start-example-basic-auth
- tanstack-solid-start-example-basic-authjs
- tanstack-solid-start-example-basic-cloudflare
- tanstack-solid-start-example-basic-netlify
- tanstack-solid-start-example-basic-nitro
- tanstack-start-example-basic-solid-query
- tanstack-solid-start-example-basic-static
- tanstack-solid-start-bun-hosting
- tanstack-solid-start-example-convex-better-auth
- tanstack-solid-start-example-counter
- tanstack-solid-start-i18n-paraglide
- tanstack-solid-start-example-large
- tanstack-solid-start-streaming-data-from-server-functions
- tanstack-solid-start-example-supabase-basic
- tanstack-solid-start-tailwind-v4
- tanstack-router-solid-example-view-transitions
- tanstack-router-solid-example-with-framer-motion
- tanstack-router-solid-example-with-trpc
@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@6468commit:
aa6f711Actionable 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: GuardparsedParamswhenskipRouteOnParseErroris enabled.parsedParamsis now optional, butkey in parsedParams!will throw if it’sundefined. This can surface as a runtime error during matching whenskipRouteOnParseErroris used. Please guard with a fallback object (or default it ingetMatchedRoutes).🐛 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(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
📝 Walkthrough
Walkthrough#
This PR removes snapshot-based route-matching optimizations and simplifies the navigation API across TanStack Router. Changes include eliminating
NavigationResult,skipTransitionerLoad, andMatchSnapshottypes; removing async return values from historypush/replace; simplifying Transitioner implementations to always callrouter.load; adjusting route tree generated types for pathless layouts; and updating test expectations accordingly.Changes#
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.tsFileRoutesByPathtype declarations to changefullPathvalues: layout routes now use empty string''instead of'/', and redirect routes normalized from trailing-slash to non-trailing-slash paths.packages/history/src/index.tsNavigationResulttype,skipTransitionerLoadoption, andnavigateOptsparameter from subscribers. ChangedRouterHistory.pushandRouterHistory.replacereturn types fromPromise<NavigationResult>tovoid. Removed TSR-specific fields fromParsedHistoryState.packages/router-core/src/router.tsMatchSnapshot,MatchRoutesResulttypes and snapshot parameters fromMatchRoutesOpts. SimplifiedmatchRoutesInternalto returnArray<AnyRouteMatch>directly. UpdatedLoadFnto remove_skipUpdateLatestLocationoption. AddedresetNextScrollfield toRouterCore.packages/router-core/src/location.ts,packages/router-core/src/index.tsMatchSnapshotandValidatedSearchEntryinterfaces. Removed_matchSnapshotfield fromParsedLocation.packages/router-core/src/scroll-restoration.ts__TSR_resetScrollstate flag to checking router-levelresetNextScrollflag.packages/react-router/src/Transitioner.tsx,packages/solid-router/src/Transitioner.tsx,packages/vue-router/src/Transitioner.tsxrouter.loadinstead of conditionally checkingnavigateOpts.skipTransitionerLoad. RemovedSubscriberArgsimports.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.tsxawaiton history navigation calls and replacedwaitForblocks with direct assertions orfindByTestIdqueries, loosening test timing constraints.packages/router-core/tests/load.test.ts,packages/vue-router/tests/store-updates-during-navigation.test.tsxpackages/router-devtools-core/src/BaseTanStackRouterDevtoolsPanel.tsxresetNextScrollto the exclusion list for explorer state property mapping.Estimated code review effort#
🎯 4 (Complex) | ⏱️ ~50 minutes
Possibly related PRs#
NavigationResult/skipTransitionerLoadadditions introduced in that PR, undoing navigation optimization logic.routeTree.fullPathchanges for pathless layout routes; both address how layout route absolute paths are computed.router-core's load/match async control flow andLoadFnsignature simplification.Suggested reviewers#
Poem#
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
Comment `@coderabbitai help` to get the list of available commands and usage tips.