fix(router-core): lane match loader rewrite #7805
main fromrefs/pull/7805/head·merged by Sheraff(GitHub profile, opens in a new tab) fixed by this PR#
- https://github.com/TanStack/router/issues/2980
- https://github.com/TanStack/router/issues/3179
- https://github.com/TanStack/router/issues/3920
- https://github.com/TanStack/router/issues/3928
- https://github.com/TanStack/router/issues/4444
- https://github.com/TanStack/router/issues/4467
- https://github.com/TanStack/router/issues/4476
- https://github.com/TanStack/router/issues/4572
- https://github.com/TanStack/router/issues/4614
- https://github.com/TanStack/router/issues/4759
- https://github.com/TanStack/router/issues/5427
- https://github.com/TanStack/router/issues/6107
- https://github.com/TanStack/router/issues/6221
- https://github.com/TanStack/router/issues/6351
- https://github.com/TanStack/router/issues/6371
- https://github.com/TanStack/router/pull/7051
- https://github.com/TanStack/router/issues/7120
- https://github.com/TanStack/router/issues/7283
- https://github.com/TanStack/router/issues/7367
- https://github.com/TanStack/router/issues/7379
- https://github.com/TanStack/router/issues/7457
- https://github.com/TanStack/router/issues/7602
- https://github.com/TanStack/router/issues/7635
- https://github.com/TanStack/router/pull/7673
- https://github.com/tanStack/router/issues/7753
- https://github.com/TanStack/router/issues/7759
- https://github.com/TanStack/router/issues/7815
fixes #2980, fixes #3179, fixes #3920, fixes #3928, fixes #4444, fixes #4467, fixes #4476, fixes #4572, fixes #4614, fixes #4759, fixes #5427, fixes #6107, fixes #6221, fixes #6351, fixes #6371, fixes #7051, fixes #7120, fixes #7283, fixes #7367, fixes #7379, fixes #7457, fixes #7602, fixes #7635, fixes #7673, fixes #7753, fixes #7759, fixes #7815
Already fixed on main (but we added tests)#
- https://github.com/TanStack/router/issues/2182
- https://github.com/TanStack/router/issues/2255
- https://github.com/TanStack/router/issues/2905
- https://github.com/TanStack/router/issues/3293
- https://github.com/TanStack/router/issues/4078
- https://github.com/TanStack/router/issues/4517
- https://github.com/TanStack/router/issues/4684
- https://github.com/TanStack/router/issues/4696
- https://github.com/TanStack/router/issues/5106
- https://github.com/TanStack/router/issues/5778
- https://github.com/TanStack/router/issues/6388
- https://github.com/TanStack/router/issues/7638
Ignored by this PR#
Summary by CodeRabbit#
- New Features
- Added selective SSR, client-only route, hydration, and pending-state coverage.
- Improved route preloading, navigation transitions, redirects, caching, and hot updates.
- Bug Fixes
- Fixed pending UI timing, loader retries, abort handling, stale data, and error recovery.
- Corrected SSR response statuses and rendering behavior.
- Tests
- Expanded React, Solid, Vue, SSR, hydration, preload, HMR, and navigation regression coverage.
- Documentation
- Clarified preload behavior, cache lifetimes, router state, and match semantics.
- 1
Sheraff(GitHub profile, opens in a new tab) changed the title
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: router-plugin
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: start-server-core
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: vue-router
🚀 Changeset Version Preview#
4 package(s) bumped directly, 19 bumped as dependents.
🟩 Patch bumps#
Package Version Reason @tanstack/react-router1.170.18 → 1.170.19 Changeset @tanstack/router-core1.171.15 → 1.171.16 Changeset @tanstack/solid-router1.170.18 → 1.170.19 Changeset @tanstack/vue-router1.170.17 → 1.170.18 Changeset @tanstack/react-start1.168.35 → 1.168.36 Dependent @tanstack/react-start-client1.168.16 → 1.168.17 Dependent @tanstack/react-start-rsc0.1.34 → 0.1.35 Dependent @tanstack/react-start-server1.167.23 → 1.167.24 Dependent @tanstack/router-cli1.167.21 → 1.167.22 Dependent @tanstack/router-generator1.167.21 → 1.167.22 Dependent @tanstack/router-plugin1.168.23 → 1.168.24 Dependent @tanstack/router-vite-plugin1.167.23 → 1.167.24 Dependent @tanstack/solid-start1.168.34 → 1.168.35 Dependent @tanstack/solid-start-client1.168.16 → 1.168.17 Dependent @tanstack/solid-start-server1.167.23 → 1.167.24 Dependent @tanstack/start-client-core1.170.14 → 1.170.15 Dependent @tanstack/start-plugin-core1.171.26 → 1.171.27 Dependent @tanstack/start-server-core1.169.18 → 1.169.19 Dependent @tanstack/start-static-server-functions1.167.19 → 1.167.20 Dependent @tanstack/start-storage-context1.167.17 → 1.167.18 Dependent @tanstack/vue-start1.168.33 → 1.168.34 Dependent @tanstack/vue-start-client1.167.19 → 1.167.20 Dependent @tanstack/vue-start-server1.167.23 → 1.167.24 Dependent Note
Reviews paused#
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
reviews.auto_review.auto_pause_after_reviewed_commitssetting.Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.
Use the checkboxes below for quick actions:
- ▶️ Resume reviews
- 🔍 Trigger review
📝 Walkthrough
Walkthrough#
The PR rewrites router loading around client/server lanes, simplifies match stores, updates React/Solid/Vue rendering and SSR integration, changes HMR refresh behavior, adds extensive lifecycle and hydration tests, and updates loading documentation and end-to-end fixtures.
Changes#
Router loading pipeline
Layer / File(s) Summary Client/server lane orchestration
packages/router-core/src/load-client.ts,packages/router-core/src/load-server.ts,packages/router-core/src/router.tsClient and server navigation use lane-based contextualization, loading, failure reduction, asset projection, caching, cancellation, and commit flows. Match and store contracts
packages/router-core/src/Matches.ts,packages/router-core/src/stores.ts,packages/router-core/src/route.ts,packages/router-core/src/redirect.tsPending, redirect, lazy-loading, and internal match state shapes are simplified and aligned with semantic match reuse. Adapter rendering and transitions
packages/react-router/src/*,packages/solid-router/src/*,packages/vue-router/src/*Pending rendering, reset keys, transition acknowledgement, not-found propagation, hydration behavior, and SSR response statuses are updated across adapters. Regression coverage
packages/router-core/tests/*,packages/react-router/tests/*,packages/solid-router/tests/*,packages/vue-router/tests/*,packages/start-server-core/tests/*Tests cover hydration, preload adoption, abort ownership, pending generations, redirects, lazy chunks, server failures, request cancellation, and lifecycle events. HMR refresh flow
packages/router-plugin/src/core/hmr/handle-route-update.ts,packages/router-plugin/tests/*HMR updates rebuild route trees, clear lazy state and path caches, synchronize route exports, and invoke targeted route refreshes. Documentation and end-to-end fixtures
docs/router/*,e2e/*,benchmarks/memory/*,.changeset/lane-match-loader-rewrite.mdPublic loading semantics, cache timing, match state, SSR behavior, issue reproductions, and benchmark cancellation handling are updated. Estimated code review effort: 5 (Critical) | ~120 minutes
Possibly related issues
#2980— Preload and cache-generation handling covers reuse of active ancestor data across repeated preloads.#3179— Preload and semantic match handling coverscauseandbeforeLoadbehavior across cached and active matches.#3928— Loader flight cancellation and abort-aware result handling are directly covered by the client lane pipeline and regression tests.#4614— Selective SSR preload context behavior is covered by the cached-parent end-to-end test.#7283— Solid selective SSR hydration forssr: falseandssr: 'data-only'pending routes is covered by the DEV-mode end-to-end suite.#7379— Direct-loadhead({ matches })context and loader data population are covered by router-core tests.#7457— Initial redirects after asynchronousbeforeLoadare covered by a React end-to-end reproduction.#7910— Pending-matchloadPromisesynchronization removal directly relates to the retrieved stale pending snapshot regression.
Possibly related PRs
- TanStack/router#6201 — Shares updates to
Transitioner.tsxand URL/publicHref redirect handling. - TanStack/router#6704 — Continues the same router reactivity/store refactor across match, transition, and router-core loading APIs.
- TanStack/router#7152 — Refactors the same router store APIs and consuming components/functions.
Suggested labels:
package: react-start,package: solid-startSuggested reviewers:
schiller-manuel🚥 Pre-merge checks | ✅ 2 | ❌ 3
❌ Failed checks (3 warnings)#
Check name Status Explanation Resolution Linked Issues check ⚠️ Warning The implementation covers most linked loader, pending, SSR, hydration, redirect, preload, and lifecycle issues, but no change addresses the #7815scroll-restoration requirements.Implement or explicitly exclude the #7815requirements, including pre-paint PUSH reset and native history restoration behavior.Out of Scope Changes check ⚠️ Warning The changes include unrelated public tuple-label edits and router-devtools package script changes that are not tied to the linked lane-loader objectives. Remove the unrelated tuple-label and devtools script changes, or split them into separate pull requests with matching objectives. Docstring Coverage ⚠️ Warning Docstring coverage is 11.18% 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 title clearly identifies the primary change: a router-core lane match loader rewrite. ✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
- Create stacked PR
- Commit on current branch
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Commit unit tests in branch `fix-router-core-lane-match-loader`
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment `@coderabbitai help` to get the list of available commands.Bundle Size Benchmarks#
- Commit:
8431fac75823 - Measured at:
2026-08-04T11:36:39.350Z - Baseline source:
history:65ae78cf0625 - Dashboard: bundle-size history
The following scenarios have bundle-size changes compared with the baseline:
Scenario Current (gzip) Delta vs baseline Initial gzip Raw Brotli Trend react-router.minimal87.11 KiB -246 B (-0.28%) 86.97 KiB 269.28 KiB 75.85 KiB ███████████▁ react-router.full90.92 KiB -151 B (-0.16%) 90.78 KiB 281.29 KiB 79.07 KiB ███████████▁ solid-router.minimal34.85 KiB -688 B (-1.89%) 34.73 KiB 100.14 KiB 31.46 KiB ███████████▁ solid-router.full39.95 KiB -647 B (-1.56%) 39.83 KiB 115.37 KiB 35.96 KiB ███████████▁ vue-router.minimal52.14 KiB -875 B (-1.61%) 52.02 KiB 143.30 KiB 46.86 KiB ███████████▁ vue-router.full58.10 KiB -860 B (-1.42%) 57.97 KiB 162.07 KiB 52.15 KiB ███████████▁ react-start.minimal102.00 KiB +18 B (+0.02%) 101.87 KiB 318.27 KiB 88.50 KiB ▁▁▁▁▁▁▁▁▁▁▁█ react-start.deferred-hydration102.74 KiB +15 B (+0.01%) 101.89 KiB 319.64 KiB 89.25 KiB ▁▁▁▁▁▁▁▁▁▁▁█ react-start.full105.41 KiB +45 B (+0.04%) 105.27 KiB 328.27 KiB 91.38 KiB ▁▁▁▁▁▁▁▁▁▁▁█ react-start.rsbuild.minimal99.79 KiB +96 B (+0.09%) 99.62 KiB 312.70 KiB 86.01 KiB ▁▁▁▂▂▂▂▂▂▂▂█ react-start.rsbuild.minimal-iife100.19 KiB +97 B (+0.09%) 100.02 KiB 313.64 KiB 86.37 KiB ▁▁▁▂▂▂▂▂▂▂▂█ react-start.rsbuild.full103.12 KiB +221 B (+0.21%) 102.95 KiB 322.85 KiB 88.78 KiB ▁▁▁▁▁▁▁▁▁▁▁█ solid-start.minimal49.67 KiB +60 B (+0.12%) 49.54 KiB 148.01 KiB 44.14 KiB ▁▁▁▁▁▁▁▁▁▁▁█ solid-start.deferred-hydration52.93 KiB +64 B (+0.12%) 49.60 KiB 156.05 KiB 47.21 KiB ▁▁▁▁▁▁▁▁▁▁▁█ solid-start.full54.95 KiB -480 B (-0.85%) 54.82 KiB 163.80 KiB 48.64 KiB ███████████▁ vue-start.minimal70.46 KiB -583 B (-0.80%) 70.33 KiB 201.06 KiB 62.61 KiB ███████████▁ vue-start.full74.42 KiB -624 B (-0.81%) 74.29 KiB 213.66 KiB 65.95 KiB ███████████▁ Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.
- Commit:
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-rsbuild
- 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-example-rscs
- 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/arktype-adapter@7805@tanstack/eslint-plugin-router
npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@7805@tanstack/eslint-plugin-start
npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@7805@tanstack/history
npm i https://pkg.pr.new/@tanstack/history@7805@tanstack/nitro-v2-vite-plugin
npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@7805@tanstack/react-router
npm i https://pkg.pr.new/@tanstack/react-router@7805@tanstack/react-router-devtools
npm i https://pkg.pr.new/@tanstack/react-router-devtools@7805@tanstack/react-router-ssr-query
npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@7805@tanstack/react-start
npm i https://pkg.pr.new/@tanstack/react-start@7805@tanstack/react-start-client
npm i https://pkg.pr.new/@tanstack/react-start-client@7805@tanstack/react-start-rsc
npm i https://pkg.pr.new/@tanstack/react-start-rsc@7805@tanstack/react-start-server
npm i https://pkg.pr.new/@tanstack/react-start-server@7805@tanstack/router-cli
npm i https://pkg.pr.new/@tanstack/router-cli@7805@tanstack/router-core
npm i https://pkg.pr.new/@tanstack/router-core@7805@tanstack/router-devtools
npm i https://pkg.pr.new/@tanstack/router-devtools@7805@tanstack/router-devtools-core
npm i https://pkg.pr.new/@tanstack/router-devtools-core@7805@tanstack/router-generator
npm i https://pkg.pr.new/@tanstack/router-generator@7805@tanstack/router-plugin
npm i https://pkg.pr.new/@tanstack/router-plugin@7805@tanstack/router-ssr-query-core
npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@7805@tanstack/router-utils
npm i https://pkg.pr.new/@tanstack/router-utils@7805@tanstack/router-vite-plugin
npm i https://pkg.pr.new/@tanstack/router-vite-plugin@7805@tanstack/solid-router
npm i https://pkg.pr.new/@tanstack/solid-router@7805@tanstack/solid-router-devtools
npm i https://pkg.pr.new/@tanstack/solid-router-devtools@7805@tanstack/solid-router-ssr-query
npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@7805@tanstack/solid-start
npm i https://pkg.pr.new/@tanstack/solid-start@7805@tanstack/solid-start-client
npm i https://pkg.pr.new/@tanstack/solid-start-client@7805@tanstack/solid-start-server
npm i https://pkg.pr.new/@tanstack/solid-start-server@7805@tanstack/start-client-core
npm i https://pkg.pr.new/@tanstack/start-client-core@7805@tanstack/start-fn-stubs
npm i https://pkg.pr.new/@tanstack/start-fn-stubs@7805@tanstack/start-plugin-core
npm i https://pkg.pr.new/@tanstack/start-plugin-core@7805@tanstack/start-server-core
npm i https://pkg.pr.new/@tanstack/start-server-core@7805@tanstack/start-static-server-functions
npm i https://pkg.pr.new/@tanstack/start-static-server-functions@7805@tanstack/start-storage-context
npm i https://pkg.pr.new/@tanstack/start-storage-context@7805@tanstack/valibot-adapter
npm i https://pkg.pr.new/@tanstack/valibot-adapter@7805@tanstack/virtual-file-routes
npm i https://pkg.pr.new/@tanstack/virtual-file-routes@7805@tanstack/vue-router
npm i https://pkg.pr.new/@tanstack/vue-router@7805@tanstack/vue-router-devtools
npm i https://pkg.pr.new/@tanstack/vue-router-devtools@7805@tanstack/vue-router-ssr-query
npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@7805@tanstack/vue-start
npm i https://pkg.pr.new/@tanstack/vue-start@7805@tanstack/vue-start-client
npm i https://pkg.pr.new/@tanstack/vue-start-client@7805@tanstack/vue-start-server
npm i https://pkg.pr.new/@tanstack/vue-start-server@7805@tanstack/zod-adapter
npm i https://pkg.pr.new/@tanstack/zod-adapter@7805commit:
27d10cbMerging this PR will regress 0 benchmarks#
:warning: Different runtime environments detected
Some benchmarks with significant performance changes were compared across different runtime environments, which may affect the accuracy of the results.
⚡ 101improved benchmarks❌ 26 (👁 26)regressed benchmarks✅ 53untouched benchmarksPerformance Changes#
:information_source: Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.
[!TIP] Curious why this is faster? Comment
@codspeedbot explain why this is fasteron this PR, or directly use the CodSpeed MCP with your agent.
Comparingfix-router-core-lane-match-loader(27d10cb) withmain(65ae78c)Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/vue-router/src/useMatch.tsx (1)
137-154: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick winPreserve the generic result type instead of erasing it with
any.Vue.computed<any>allows the implementation to violate the declaredThrowOrOptional<UseMatchResult<...>>contract without a compiler error. Typematchandresultfrom the existing generic aliases.As per coding guidelines, “Use TypeScript strict mode with extensive type safety.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/vue-router/src/useMatch.tsx` around lines 137 - 154, Update the computed result in the useMatch flow to preserve the existing generic result type instead of using Vue.computed<any>. Type match and result with the existing generic aliases, including the declared ThrowOrOptional<UseMatchResult<...>> contract, so incorrect return values are caught by TypeScript while preserving the current selection and missing-match behavior.Source: Coding guidelines
🧹 Nitpick comments (7)
e2e/solid-start/selective-ssr/tests/issue-7283-dev-hydration.spec.ts (1)
27-27: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse braces for all conditional bodies.
These one-line
ifstatements violate the repository’s TypeScript control-flow convention.As per coding guidelines,
**/*.{ts,tsx,js,jsx}must use curly braces for control statements.Also applies to: 79-79, 84-84
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@e2e/solid-start/selective-ssr/tests/issue-7283-dev-hydration.spec.ts` at line 27, Update the one-line conditional statements in issue-7283-dev-hydration.spec.ts, including the checks around lines 27, 79, and 84, to wrap each conditional body in curly braces while preserving their existing behavior.Source: Coding guidelines
packages/solid-router/tests/transitioner-remount.test.tsx (1)
54-54: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAvoid discarding location-state type safety.
Assert the partial state shape directly instead of casting to
any.Proposed change
- expect((router.state.location.state as any).remounted).toBe(true) + expect(router.state.location.state).toMatchObject({ remounted: true })As per coding guidelines, TypeScript files must use strict mode with extensive type safety.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/solid-router/tests/transitioner-remount.test.tsx` at line 54, Replace the any cast in the remounted-state assertion with a type-safe assertion of the partial location-state shape, using an appropriate typed access or narrowing approach so router.state.location.state remains checked by TypeScript.Source: Coding guidelines
packages/router-core/tests/fatal-load-rejection.test.ts (1)
25-30: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winModel the error component without bypassing its route contract.
as anyprevents this test from detecting changes to theerrorComponentinterface. Use a callable mock component with itspreloadproperty attached, matching the runtime shape used elsewhere.Proposed fix
+ const ErrorComponent = Object.assign(() => null, { + preload: errorComponentPreload, + }) + const rootRoute = new BaseRootRoute({ loader: () => 'root data', - errorComponent: { preload: errorComponentPreload } as any, + errorComponent: ErrorComponent, })As per coding guidelines, TypeScript files must use strict mode with extensive type safety.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/router-core/tests/fatal-load-rejection.test.ts` around lines 25 - 30, Update the errorComponent setup in the BaseRootRoute test to use a typed callable mock component with its preload property attached, matching the runtime component shape. Remove the as any cast so TypeScript validates the errorComponent contract and the test catches interface changes.Source: Coding guidelines
packages/router-core/tests/issue-6371-search-default-normalization-abort.test.ts (1)
60-75: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winKeep the canonical replacement setup type-checked.
Both
as anycasts allow this regression test to keep compiling ifbuildLocationorcommitLocationchanges incompatibly. Please use their declared/internal option types or a typed helper for the Transitioner operation being reproduced.As per coding guidelines, TypeScript files must use strict mode with extensive type safety.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/router-core/tests/issue-6371-search-default-normalization-abort.test.ts` around lines 60 - 75, Remove the as any casts from the buildLocation and commitLocation calls in this regression test. Use the declared option types or a typed helper representing the Transitioner operation so both canonical replacement setup calls remain strictly type-checked while preserving their existing behavior.Source: Coding guidelines
packages/router-core/tests/issue-4444-param-parse-error-lazy-child.test.ts (1)
19-21: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert that the lazy child chunk was never requested.
The test can currently pass even if
lazyFnruns before the child is trimmed, leaving the documented regression partially uncovered.Proposed assertion
expect( router.state.matches.find((match) => match.status === 'pending'), ).toBeUndefined() +expect(lazyFn).not.toHaveBeenCalled() expect(router.state.isLoading).toBe(false)Also applies to: 60-68
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/router-core/tests/issue-4444-param-parse-error-lazy-child.test.ts` around lines 19 - 21, Update the test using the lazyFn mock so it explicitly asserts lazyFn was never called when the child route is trimmed after the parameter parse error. Place the assertion after the relevant navigation or error-handling flow, preserving the existing test behavior while verifying the lazy child chunk is not requested.packages/react-router/tests/transactional-loading.test.tsx (1)
130-148: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCapture every committed pair to verify atomic publication.
The final sequential assertions can miss a transient mixed-generation render after
childRefreshresolves. Record parent/child values on each committed render and assert that neitherparent-v2/child-v1norparent-v1/child-v2occurs.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/react-router/tests/transactional-loading.test.tsx` around lines 130 - 148, Update the transactional loading test around the final refresh sequence to record the parent and child values on every committed render, then assert no mixed-generation pair occurs: parent-v2 with child-v1 or parent-v1 with child-v2. Keep the existing final-state assertions and use the render-observation mechanism already provided by the test setup.packages/router-core/src/router.ts (1)
1330-1338: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSilent
catch {}hides listener failures.Swallowing all listener exceptions keeps one bad listener from breaking others, but the fully empty catch also hides real bugs during development. Consider logging in non-production.
♻️ Suggested dev logging
if (listener.eventType === routerEvent.type) { try { listener.fn(routerEvent) - } catch {} + } catch (err) { + if (process.env.NODE_ENV !== 'production') { + console.error( + `Error in router event listener for "${routerEvent.type}":`, + err, + ) + } + } }If tests assert fully-silent behavior, feel free to disregard.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/router-core/src/router.ts` around lines 1330 - 1338, Update the catch block in the emit method to retain listener isolation while reporting listener exceptions in non-production environments. Preserve the existing behavior of continuing to notify other subscribers and keeping production logging silent.🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Inline comments: In `@e2e/solid-start/selective-ssr/src/routes/ssr-false-pending-min.tsx`: - Around line 6-13: Update recordEvent to avoid casting window to any by declaring a local Window augmentation for the __events event buffer, then initialize and append through window.__events. Preserve the existing server guard and event shape, including the performance timestamp. In `@packages/react-router/tests/router.test.tsx`: - Around line 2463-2467: Update the navigation assertion in the router test to target the parent route’s specific not-found boundary, using its unique test identifier or boundary-specific text instead of the broad “Not Found” match; keep the existing home-page and navigation steps unchanged. In `@packages/router-core/tests/issue-6221-head-waits-for-loader.test.ts`: - Line 23: Update the authentication check in the relevant test to wrap the notFound call inside curly braces, preserving the existing condition and behavior. In `@packages/solid-router/src/Transitioner.tsx`: - Around line 47-65: Move the Solid.onCleanup registration for unsub immediately after router.history.subscribe(router.load), before the early return in the Transitioner setup. Keep the existing cleanup callback unchanged and remove the later registration so every execution path disposes the history subscription. In `@packages/solid-router/tests/on-rendered-change-info.test.tsx`: - Around line 44-61: Update the onRendered transition handling to call getLocationChangeInfo with the previously rendered location as the first argument and the latest resolved location as the second. Ensure fromLocation, toLocation, and change flags reflect the actual transition, including same-href state changes; locate the change in the code that constructs the onRendered event. In `@packages/vue-router/tests/pending-fallback-promise-replacement.test.tsx`: - Around line 13-18: Update the afterEach cleanup hook to drain and await all testCleanups while fake timers remain active, then restore real timers in a finally block so timer state is reset even if cleanup fails. Preserve the existing cleanup() call after the callbacks settle. --- Outside diff comments: In `@packages/vue-router/src/useMatch.tsx`: - Around line 137-154: Update the computed result in the useMatch flow to preserve the existing generic result type instead of using Vue.computed<any>. Type match and result with the existing generic aliases, including the declared ThrowOrOptional<UseMatchResult<...>> contract, so incorrect return values are caught by TypeScript while preserving the current selection and missing-match behavior. --- Nitpick comments: In `@e2e/solid-start/selective-ssr/tests/issue-7283-dev-hydration.spec.ts`: - Line 27: Update the one-line conditional statements in issue-7283-dev-hydration.spec.ts, including the checks around lines 27, 79, and 84, to wrap each conditional body in curly braces while preserving their existing behavior. In `@packages/react-router/tests/transactional-loading.test.tsx`: - Around line 130-148: Update the transactional loading test around the final refresh sequence to record the parent and child values on every committed render, then assert no mixed-generation pair occurs: parent-v2 with child-v1 or parent-v1 with child-v2. Keep the existing final-state assertions and use the render-observation mechanism already provided by the test setup. In `@packages/router-core/src/router.ts`: - Around line 1330-1338: Update the catch block in the emit method to retain listener isolation while reporting listener exceptions in non-production environments. Preserve the existing behavior of continuing to notify other subscribers and keeping production logging silent. In `@packages/router-core/tests/fatal-load-rejection.test.ts`: - Around line 25-30: Update the errorComponent setup in the BaseRootRoute test to use a typed callable mock component with its preload property attached, matching the runtime component shape. Remove the as any cast so TypeScript validates the errorComponent contract and the test catches interface changes. In `@packages/router-core/tests/issue-4444-param-parse-error-lazy-child.test.ts`: - Around line 19-21: Update the test using the lazyFn mock so it explicitly asserts lazyFn was never called when the child route is trimmed after the parameter parse error. Place the assertion after the relevant navigation or error-handling flow, preserving the existing test behavior while verifying the lazy child chunk is not requested. In `@packages/router-core/tests/issue-6371-search-default-normalization-abort.test.ts`: - Around line 60-75: Remove the as any casts from the buildLocation and commitLocation calls in this regression test. Use the declared option types or a typed helper representing the Transitioner operation so both canonical replacement setup calls remain strictly type-checked while preserving their existing behavior. In `@packages/solid-router/tests/transitioner-remount.test.tsx`: - Line 54: Replace the any cast in the remounted-state assertion with a type-safe assertion of the partial location-state shape, using an appropriate typed access or narrowing approach so router.state.location.state remains checked by TypeScript.🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID:
a9eff563-1e9d-4b5e-9e0d-17c99dcf056c📥 Commits
Reviewing files that changed from the base of the PR and between 41f7bf32837e751b2874e7d827f7456f8a5bd716 and ceaa4d26f29671842f548ead4a7d91715736bd6b.
📒 Files selected for processing (162)
benchmarks/memory/client/scenarios/interrupted-navigations/shared.tse2e/solid-start/selective-ssr/src/routeTree.gen.tse2e/solid-start/selective-ssr/src/routes/ssr-false-pending-min.tsxe2e/solid-start/selective-ssr/tests/issue-7283-dev-hydration.spec.tspackages/react-router/src/Match.tsxpackages/react-router/src/Matches.tsxpackages/react-router/src/Transitioner.tsxpackages/react-router/src/lazyRouteComponent.tsxpackages/react-router/src/ssr/renderRouterToStream.tsxpackages/react-router/src/ssr/renderRouterToString.tsxpackages/react-router/tests/Matches.test.tsxpackages/react-router/tests/ancestor-loader-child-pending-min.test.tsxpackages/react-router/tests/component-preload-retry-pending-min.test.tsxpackages/react-router/tests/component-preload-retry.test.tsxpackages/react-router/tests/errorComponent.test.tsxpackages/react-router/tests/hydration-capped-boundary-pending.test.tsxpackages/react-router/tests/hydration-terminal-lane.test.tsxpackages/react-router/tests/issue-4759-pending-frame.test.tsxpackages/react-router/tests/issue-7051-force-pending-suspense.test.tsxpackages/react-router/tests/issue-7367-pending-min-redirect.test.tsxpackages/react-router/tests/issue-7457-redirect-chain-first-load.test.tsxpackages/react-router/tests/issue-7638-invalidate-transition-error.test.tsxpackages/react-router/tests/loaders.test.tsxpackages/react-router/tests/on-rendered-same-href-state.test.tsxpackages/react-router/tests/pending-fallback-promise-replacement.test.tsxpackages/react-router/tests/preloaded-mount-resolution.test.tsxpackages/react-router/tests/redirect.test.tsxpackages/react-router/tests/root-pending-min.test.tsxpackages/react-router/tests/router.test.tsxpackages/react-router/tests/store-updates-during-navigation.test.tsxpackages/react-router/tests/transactional-loading.test.tsxpackages/react-router/tests/transitioner-listener-errors.test.tsxpackages/react-router/tests/transitioner-render-ack.test.tsxpackages/react-router/tests/transitioner-router-swap.test.tsxpackages/react-router/tests/useNavigate.test.tsxpackages/router-core/src/Matches.tspackages/router-core/src/hydrate.tspackages/router-core/src/isServer/client.tspackages/router-core/src/isServer/development.tspackages/router-core/src/isServer/server.tspackages/router-core/src/load-matches.tspackages/router-core/src/load.client.tspackages/router-core/src/load.server.tspackages/router-core/src/redirect.tspackages/router-core/src/route-chunks.tspackages/router-core/src/route.tspackages/router-core/src/router.tspackages/router-core/src/ssr/createRequestHandler.tspackages/router-core/src/ssr/ssr-client.tspackages/router-core/src/ssr/ssr-server.tspackages/router-core/src/stores.tspackages/router-core/tests/background-assets-stale.test.tspackages/router-core/tests/background-trim-abort.test.tspackages/router-core/tests/blocked-navigation-current-load.test.tspackages/router-core/tests/boundary-component-chunk.test.tspackages/router-core/tests/callbacks.test.tspackages/router-core/tests/chunk-failure-lifecycle.test.tspackages/router-core/tests/client-lane-adversarial.test.tspackages/router-core/tests/fatal-load-rejection.test.tspackages/router-core/tests/granular-stores.test.tspackages/router-core/tests/hydrate.test.tspackages/router-core/tests/hydrated-stay-match-data.test.tspackages/router-core/tests/hydration-asset-context-order.test.tspackages/router-core/tests/hydration-boundary-chunks.test.tspackages/router-core/tests/hydration-currentness.test.tspackages/router-core/tests/invalidate-pre-rematch-failure.test.tspackages/router-core/tests/issue-3928-rapid-reload-abort.test.tspackages/router-core/tests/issue-4078-loader-notfound-root-boundary.test.tspackages/router-core/tests/issue-4444-param-parse-error-lazy-child.test.tspackages/router-core/tests/issue-4476-preload-navigate-abort.test.tspackages/router-core/tests/issue-4572-preload-root-beforeload-flags.test.tspackages/router-core/tests/issue-4684-head-on-beforeload-error.test.tspackages/router-core/tests/issue-5106-hydrated-notfound-boundary.test.tspackages/router-core/tests/issue-6107-preload-chunk-failure.test.tspackages/router-core/tests/issue-6221-head-waits-for-loader.test.tspackages/router-core/tests/issue-6351-fuzzy-notfound-layout.test.tspackages/router-core/tests/issue-6371-search-default-normalization-abort.test.tspackages/router-core/tests/issue-7379-head-matches-direct-load.test.tspackages/router-core/tests/issue-7635-dehydrated-error-child-head.test.tspackages/router-core/tests/load-route-chunk.test.tspackages/router-core/tests/load.test.tspackages/router-core/tests/preflight-reentrant-context.test.tspackages/router-core/tests/preload-adoption.test.tspackages/router-core/tests/preload-background-parent-coherence.test.tspackages/router-core/tests/preload-public-cache-behavior.test.tspackages/router-core/tests/preload-public-signal-lifetime.test.tspackages/router-core/tests/routerTestUtils.tspackages/router-core/tests/serial-failure-foreground-prefix.test.tspackages/router-core/tests/server-async-headers-decorative-hang.test.tspackages/router-core/tests/server-beforeload-preload-flag.test.tspackages/router-core/tests/server-chunk-failure-lifecycle.test.tspackages/router-core/tests/server-concurrent-error-notfound.test.tspackages/router-core/tests/server-headers-asset-failure.test.tspackages/router-core/tests/server-loader-abort-error.test.tspackages/router-core/tests/server-serial-ssr-notfound.test.tspackages/router-core/tests/server-ssr-false-assets.test.tspackages/router-core/tests/server-ssr-option-error.test.tspackages/router-core/tests/stay-match-abort.test.tspackages/router-core/tests/superseded-load-await.test.tspackages/router-devtools-core/src/AgeTicker.tsxpackages/router-devtools-core/src/BaseTanStackRouterDevtoolsPanel.tsxpackages/router-plugin/src/core/hmr/handle-route-update.tspackages/router-plugin/tests/add-hmr.test.tspackages/router-plugin/tests/add-hmr/snapshots/react/arrow-function@true.tsxpackages/router-plugin/tests/add-hmr/snapshots/react/arrow-function@webpack-hot.tsxpackages/router-plugin/tests/add-hmr/snapshots/react/createRootRoute-inline-component@true.tsxpackages/router-plugin/tests/add-hmr/snapshots/react/createRootRoute@true.tsxpackages/router-plugin/tests/add-hmr/snapshots/react/createRootRouteWithContext-type-args@true.tsxpackages/router-plugin/tests/add-hmr/snapshots/react/explicit-undefined-component@true.tsxpackages/router-plugin/tests/add-hmr/snapshots/react/function-declaration@true.tsxpackages/router-plugin/tests/add-hmr/snapshots/react/multi-component@true.tsxpackages/router-plugin/tests/add-hmr/snapshots/react/string-literal-keys@true.tsxpackages/router-plugin/tests/add-hmr/snapshots/solid/arrow-function@true.tsxpackages/router-plugin/tests/handle-route-update.test.tspackages/solid-router/src/ClientOnly.tsxpackages/solid-router/src/Match.tsxpackages/solid-router/src/Matches.tsxpackages/solid-router/src/Transitioner.tsxpackages/solid-router/src/lazyRouteComponent.tsxpackages/solid-router/src/matchContext.tsxpackages/solid-router/src/routerStores.tspackages/solid-router/src/ssr/renderRouterToStream.tsxpackages/solid-router/src/ssr/renderRouterToString.tsxpackages/solid-router/src/useMatch.tsxpackages/solid-router/tests/Transitioner.test.tsxpackages/solid-router/tests/component-preload-retry.test.tsxpackages/solid-router/tests/link.test.tsxpackages/solid-router/tests/loaders.test.tsxpackages/solid-router/tests/on-rendered-change-info.test.tsxpackages/solid-router/tests/pending-fallback-promise-replacement.test.tsxpackages/solid-router/tests/redirect.test.tsxpackages/solid-router/tests/router.test.tsxpackages/solid-router/tests/same-route-pending-blank.test.tsxpackages/solid-router/tests/server/errorComponent.test.tsxpackages/solid-router/tests/store-updates-during-navigation.test.tsxpackages/solid-router/tests/transitioner-listener-errors.test.tsxpackages/solid-router/tests/transitioner-remount.test.tsxpackages/solid-router/tests/transitioner-render-ack.test.tsxpackages/solid-router/tests/use-match-outgoing-transition.test.tsxpackages/start-server-core/src/createStartHandler.tspackages/vue-router/src/Match.tsxpackages/vue-router/src/Matches.tsxpackages/vue-router/src/Transitioner.tsxpackages/vue-router/src/lazyRouteComponent.tsxpackages/vue-router/src/matchContext.tsxpackages/vue-router/src/routerStores.tspackages/vue-router/src/ssr/renderRouterToStream.tsxpackages/vue-router/src/ssr/renderRouterToString.tsxpackages/vue-router/src/useMatch.tsxpackages/vue-router/tests/Matches.test.tsxpackages/vue-router/tests/Transitioner.test.tsxpackages/vue-router/tests/component-preload-retry.test.tsxpackages/vue-router/tests/hydration-capped-boundary-pending.test.tsxpackages/vue-router/tests/link.test.tsxpackages/vue-router/tests/loaders.test.tsxpackages/vue-router/tests/pending-fallback-promise-replacement.test.tsxpackages/vue-router/tests/redirect.test.tsxpackages/vue-router/tests/router.test.tsxpackages/vue-router/tests/store-updates-during-navigation.test.tsxpackages/vue-router/tests/transitioner-idle-after-render.test.tsxpackages/vue-router/tests/transitioner-listener-errors.test.tsxpackages/vue-router/tests/transitioner-remount-rendered.test.tsx
💤 Files with no reviewable changes (13)
- packages/router-plugin/tests/add-hmr.test.ts
- packages/solid-router/src/matchContext.tsx
- packages/router-core/src/load-matches.ts
- packages/solid-router/tests/server/errorComponent.test.tsx
- packages/solid-router/tests/Transitioner.test.tsx
- packages/router-core/src/redirect.ts
- packages/vue-router/src/routerStores.ts
- packages/router-core/src/ssr/ssr-server.ts
- packages/solid-router/src/routerStores.ts
- packages/router-core/tests/callbacks.test.ts
- packages/vue-router/tests/redirect.test.tsx
- packages/solid-router/tests/redirect.test.tsx
- benchmarks/memory/client/scenarios/interrupted-navigations/shared.ts
e2e/solid-start/selective-ssr/src/routes/ssr-false-pending-min.tsx lines 6 to 13Resolvedby Sheraff(GitHub profile, opens in a new tab)@@ -0,0 +1,13 @@1+import { onCleanup, onMount } from 'solid-js'2+import { createFileRoute } from '@tanstack/solid-router'3+4+const pendingMinMs = 15005+6+function recordEvent(type: string) {7+ if (typeof window === 'undefined') {8+ return9+ }10+11+ const global = window as any12+ global.__events ??= []13+ global.__events.push({ type, t: performance.now() })📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash set -euo pipefail echo '--- target file ---' cat -n e2e/solid-start/selective-ssr/src/routes/ssr-false-pending-min.tsx echo '--- search __events ---' rg -n "__events|recordEvent|interface Window|declare global" e2e/solid-start/selective-ssr/src/routes -S echo '--- search repo-wide Window augmentation ---' rg -n "interface Window|declare global" -S .Repository: TanStack/router
Length of output: 4375
🏁 Script executed:
#!/bin/bash set -euo pipefail sed -n '1,80p' e2e/solid-start/selective-ssr/src/routes/ssr-false-pending-min.tsx | cat -n printf '\n--- related typings ---\n' rg -n "window\\.__(events|events)|__events|interface Window|declare global" -S e2e/solid-start/selective-ssr src . \ --glob '!**/node_modules/**' --glob '!**/dist/**' --glob '!**/build/**'Repository: TanStack/router
Length of output: 3954
Type the event buffer instead of casting
windowtoany.window as anybypasses strict TS here; add a localWindowaugmentation for__eventsand push throughwindow.__events.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@e2e/solid-start/selective-ssr/src/routes/ssr-false-pending-min.tsx` around lines 6 - 13, Update recordEvent to avoid casting window to any by declaring a local Window augmentation for the __events event buffer, then initialize and append through window.__events. Preserve the existing server guard and event shape, including the performance timestamp.Source: Coding guidelines
packages/react-router/tests/router.test.tsx lines 2463 to 2467OutdatedResolvedby Sheraff(GitHub profile, opens in a new tab)@@ -2472,17 +2460,8 @@2472246024732461 render(<RouterProvider router={router} />)247424622475- // Wait for initial load2476- await act(() => router.latestLoadPromise)2477- expect(router.state.status).toBe('idle')2478- expect(screen.getByTestId('home-page')).toBeInTheDocument()2463+ expect(await screen.findByTestId('home-page')).toBeInTheDocument()247924642480- // Navigate to the child route that throws notFound in beforeLoad24812465 await act(() => router.navigate({ to: '/parent/child' }))248224662483- // The router status should eventually become idle2484- await waitFor(() => {2485- expect(router.state.status).toBe('idle')2486- })2487-2488- expect(router.state.statusCode).toBe(404)2467+ expect(await screen.findByText(/Not Found/)).toBeInTheDocument()🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Assert the parent not-found boundary specifically.
The broad
/Not Found/assertion also passes if the root/default boundary handles the failure, so this test does not verify its stated parent-boundary behavior.Proposed fix
- expect(await screen.findByText(/Not Found/)).toBeInTheDocument() + expect(await screen.findByTestId('parent-not-found')).toBeInTheDocument()📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
Suggested change2463- expect(await screen.findByTestId('home-page')).toBeInTheDocument()2464-2465- await act(() => router.navigate({ to: '/parent/child' }))2466-2467- expect(await screen.findByText(/Not Found/)).toBeInTheDocument()2463+ expect(await screen.findByTestId('home-page')).toBeInTheDocument()2464+2465+ await act(() => router.navigate({ to: '/parent/child' }))2466+2467+ expect(await screen.findByTestId('parent-not-found')).toBeInTheDocument()🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/react-router/tests/router.test.tsx` around lines 2463 - 2467, Update the navigation assertion in the router test to target the parent route’s specific not-found boundary, using its unique test identifier or boundary-specific text instead of the broad “Not Found” match; keep the existing home-page and navigation steps unchanged.✅ Addressed in commits 7b5436b to bf90602
packages/router-core/tests/issue-6221-head-waits-for-loader.test.ts line 23OutdatedResolvedby Sheraff(GitHub profile, opens in a new tab)@@ -0,0 +3,21 @@3+import { BaseRootRoute, BaseRoute, notFound } from '../src'4+import { createTestRouter } from './routerTestUtils'5+6+const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))7+8+// https://github.com/TanStack/router/issues/62219+//10+// head() must never compute from loaderData older than the data the lane11+// commits. Two reported shapes:12+// 1. Revisiting a route whose previous visit ended in notFound — the head13+// must see the fresh successful loaderData, not run before the loader.14+// 2. Revisiting a cached success match that gets a stale reload — the head15+// title must not lag one loaderData run behind.16+describe('issue #6221: head does not run before loader data is ready', () => {17+ test('head sees fresh loaderData when a previously-notFound route loads successfully', async () => {18+ let authed = false19+ const headLoaderData: Array<unknown> = []20+21+ const articleLoader = vi.fn(async () => {22+ await sleep(5)23+ if (!authed) throw notFound()📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Wrap the
ifbody in curly braces.if (!authed) throw notFound()uses a one-line body. As per coding guidelines, always use curly braces forif,else, loops, and similar control statements; never write one-line bodies.Proposed fix
- if (!authed) throw notFound() + if (!authed) { + throw notFound() + }📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
Suggested change23- if (!authed) throw notFound()23+ if (!authed) {24+ throw notFound()25+ }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/router-core/tests/issue-6221-head-waits-for-loader.test.ts` at line 23, Update the authentication check in the relevant test to wrap the notFound call inside curly braces, preserving the existing condition and behavior.Source: Coding guidelines
✅ Addressed in commits 7b5436b to 90a7f39
packages/solid-router/src/Transitioner.tsx lines 47 to 65OutdatedResolvedby Sheraff(GitHub profile, opens in a new tab)@@ -123,12 +53,13 @@53+ resolvedLocation.state.__TSR_key === router.latestLocation.state.__TSR_key54+ ) {12355 router.emit({124- type: 'onResolved',125- ...changeInfo,126- })127-128- Solid.batch(() => {129- router.stores.status.set('idle')130- router.stores.resolvedLocation.set(router.stores.location.get())56+ type: 'onRendered',57+ ...getLocationChangeInfo(resolvedLocation, resolvedLocation),13158 })59+ } else {60+ router.load().catch(console.error)13261 }13362134- return currentIsAnyPending63+ Solid.onCleanup(() => {64+ unsub()65+ })🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash fd -a 'Transitioner\.tsx$' packages | while read -r file; do echo "=== $file ===" rg -n -C8 'history\.subscribe|onCleanup' "$file" doneRepository: TanStack/router
Length of output: 2508
🏁 Script executed:
#!/bin/bash set -euo pipefail file="packages/solid-router/src/Transitioner.tsx" echo "=== $file ===" cat -n "$file" | sed -n '1,140p' echo echo "=== sibling implementations ===" for sibling in packages/react-router/src/Transitioner.tsx packages/vue-router/src/Transitioner.tsx; do echo "--- $sibling ---" cat -n "$sibling" | sed -n '1,120p' echo doneRepository: TanStack/router
Length of output: 8640
Register the history cleanup before the early return. The canonical-location branch exits before
Solid.onCleanupis registered, sounsubis never disposed on that path. Move the cleanup registration immediately afterrouter.history.subscribe(router.load)to avoid a leaked subscription and duplicate loads on remount.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/solid-router/src/Transitioner.tsx` around lines 47 - 65, Move the Solid.onCleanup registration for unsub immediately after router.history.subscribe(router.load), before the early return in the Transitioner setup. Keep the existing cleanup callback unchanged and remove the later registration so every execution path disposes the history subscription.✅ Addressed in commits 7b5436b to fb21a42
packages/solid-router/tests/on-rendered-change-info.test.tsx lines 44 to 61OutdatedResolvedby Sheraff(GitHub profile, opens in a new tab)@@ -0,0 +41,21 @@41+ expect(await screen.findByText('Next')).toBeInTheDocument()42+ await waitFor(() => expect(onRendered).toHaveBeenCalledTimes(1))43+44+ const event = onRendered.mock.calls[0]![0]45+ expect(event.fromLocation?.pathname).toBe('/')46+ expect(event.toLocation.pathname).toBe('/next')47+ expect(event.pathChanged).toBe(true)48+ expect(event.hrefChanged).toBe(true)49+50+ await router.navigate({51+ to: '/next',52+ state: { sameHrefState: true } as any,53+ })54+ await waitFor(() => expect(onRendered).toHaveBeenCalledTimes(2))55+56+ const stateEvent = onRendered.mock.calls[1]![0]57+ expect(stateEvent.fromLocation?.state.sameHrefState).toBeUndefined()58+ expect(stateEvent.toLocation.state.sameHrefState).toBe(true)59+ expect(stateEvent.fromLocation?.href).toBe('/next')60+ expect(stateEvent.toLocation.href).toBe('/next')61+ expect(stateEvent.hrefChanged).toBe(false)🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash file="$(fd -a '^Transitioner\.tsx$' packages/solid-router/src | head -n1)" ast-grep outline "$file" --items all --match 'Transitioner' rg -n -C5 '\bonRendered\b|getLocationChangeInfo\s*\(' "$file"Repository: TanStack/router
Length of output: 648
🏁 Script executed:
#!/bin/bash set -euo pipefail # Map the relevant files first, then inspect the helper and its call sites. ast-grep outline packages/solid-router/src/Transitioner.tsx --view expanded ast-grep outline packages/solid-router/src --view expanded | sed -n '1,220p' rg -n -C 4 'getLocationChangeInfo|type: .onRendered.|latestLocation|previous.*location|rendered' packages/solid-router/src packages/solid-router/testsRepository: TanStack/router
Length of output: 38858
🏁 Script executed:
#!/bin/bash set -euo pipefail # Inspect the helper implementation and nearby tests/usages that define its semantics. rg -n -C 6 'export function getLocationChangeInfo|function getLocationChangeInfo|getLocationChangeInfo\(' packages -g '!**/dist/**' -g '!**/build/**' # If the implementation lives in router-core, map that file before reading it. helper_file="$(rg -l 'function getLocationChangeInfo|export function getLocationChangeInfo' packages -g '!**/dist/**' -g '!**/build/**' | head -n1 || true)" if [ -n "${helper_file:-}" ]; then wc -l "$helper_file" cat -n "$helper_file" | sed -n '1,240p' fiRepository: TanStack/router
Length of output: 16905
🏁 Script executed:
#!/bin/bash set -euo pipefail # Read the helper definition and the onRendered event shape to resolve the semantics. sed -n '918,955p' packages/router-core/src/router.ts rg -n -C 4 "onRendered|LocationChangeInfo|fromLocation|toLocation|pathChanged|hrefChanged" packages/router-core/src/router.ts packages/solid-router/tests/on-rendered-change-info.test.tsx packages/solid-router/src/Transitioner.tsxRepository: TanStack/router
Length of output: 16395
Pass the latest location into
getLocationChangeInfoonRenderedshould report the transition from the previously rendered location to the new one.getLocationChangeInfo(resolvedLocation, resolvedLocation)makes both sides identical, sofromLocation/toLocationand the change flags no longer match the expected event shape.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/solid-router/tests/on-rendered-change-info.test.tsx` around lines 44 - 61, Update the onRendered transition handling to call getLocationChangeInfo with the previously rendered location as the first argument and the latest resolved location as the second. Ensure fromLocation, toLocation, and change flags reflect the actual transition, including same-href state changes; locate the change in the code that constructs the onRendered event.packages/vue-router/tests/pending-fallback-promise-replacement.test.tsx lines 13 to 18OutdatedResolvedby Sheraff(GitHub profile, opens in a new tab)@@ -0,0 +1,18 @@1+import { cleanup, render, screen } from '@testing-library/vue'2+import { afterEach, expect, test, vi } from 'vitest'3+import { createControlledPromise } from '@tanstack/router-core'4+import {5+ RouterProvider,6+ createMemoryHistory,7+ createRootRoute,8+ createRouter,9+} from '../src'10+11+const testCleanups: Array<() => void | Promise<void>> = []12+13+afterEach(async () => {14+ vi.useRealTimers()15+ while (testCleanups.length) {16+ await testCleanups.pop()!()17+ }18+ cleanup()🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash set -euo pipefail printf '\n## file outline\n' ast-grep outline packages/vue-router/tests/pending-fallback-promise-replacement.test.tsx --view expanded || true printf '\n## relevant test file slice\n' cat -n packages/vue-router/tests/pending-fallback-promise-replacement.test.tsx | sed -n '1,120p' printf '\n## search for pendingMinMs and invalidations\n' rg -n "pendingMinMs|invalidations|Promise\.allSettled|useFakeTimers|useRealTimers|runAllTimersAsync|testCleanups|cleanup\(" packages/vue-router -S printf '\n## related source files using pendingMinMs\n' rg -n "pendingMinMs" packages/vue-router -SRepository: TanStack/router
Length of output: 7566
🏁 Script executed:
#!/bin/bash set -euo pipefail printf '\n## search router timer implementation\n' rg -n "pendingMinMs|setTimeout|clearTimeout|runAllTimers|useFakeTimers|useRealTimers" packages/vue-router/src packages/router-core/src -S printf '\n## similar test cleanup patterns\n' rg -n "afterEach\\(async \\(\\) => \\{|vi\\.useRealTimers\\(\\)|vi\\.useFakeTimers\\(" packages/vue-router/tests -S printf '\n## inspect pending-related implementation slices\n' for f in \ packages/vue-router/src/**/**.ts \ packages/router-core/src/**/**.ts do : doneRepository: TanStack/router
Length of output: 3128
🏁 Script executed:
#!/bin/bash set -euo pipefail printf '\n## locate source files mentioning pendingMinMs\n' fd -a -t f ".*\.(ts|tsx)$" packages/vue-router/src packages/router-core/src | while read -r f; do rg -n "pendingMinMs|setTimeout|clearTimeout|Promise\.allSettled|invalidate\\(" "$f" -S && echo "--- $f" done printf '\n## search test cleanups with useRealTimers ordering\n' rg -n "vi\.useRealTimers\(\)|vi\.useFakeTimers\(\)|afterEach\(async" packages/vue-router/tests -SRepository: TanStack/router
Length of output: 1991
🏁 Script executed:
#!/bin/bash set -euo pipefail printf '\n## locate source files mentioning pendingMinMs\n' for f in $(fd -a -t f '\.(ts|tsx)$' packages/vue-router/src packages/router-core/src); do rg -n "pendingMinMs|setTimeout|clearTimeout|Promise\.allSettled|invalidate\(" "$f" -S && printf -- '--- %s\n' "$f" done printf '\n## search test cleanups with useRealTimers ordering\n' rg -n "vi\.useRealTimers\(\)|vi\.useFakeTimers\(\)|afterEach\(async" packages/vue-router/tests -SRepository: TanStack/router
Length of output: 2431
🏁 Script executed:
#!/bin/bash set -euo pipefail printf '\n## pending-load implementation slice\n' sed -n '900,980p' packages/router-core/src/load.client.ts printf '\n## remaining timer path in pending cleanup\n' sed -n '1170,1210p' packages/router-core/src/load.client.ts printf '\n## compare with similar afterEach cleanup ordering\n' sed -n '1,60p' packages/vue-router/tests/hydration-capped-boundary-pending.test.tsxRepository: TanStack/router
Length of output: 5430
🏁 Script executed:
#!/bin/bash set -euo pipefail node - <<'JS' const fs = require('fs') console.log('Need Vitest runtime docs or repository evidence for timer semantics; searching local lockfiles/docs for vitest version...') JS rg -n "vitest" package.json pnpm-lock.yaml yarn.lock package-lock.json -S rg -n "useRealTimers|useFakeTimers|advanceTimersByTimeAsync|runAllTimersAsync" . -g '!**/dist/**' -g '!**/build/**' -SRepository: TanStack/router
Length of output: 14843
🌐 Web query:
Vitest useRealTimers pending fake timers restore behavior existing scheduled timers discarded💡 Result:
In Vitest, when you call vi.useRealTimers, it restores the native global timer functions (such as setTimeout, setInterval, etc.) by uninstalling the fake timer clock [1][2]. Regarding pending timers, the transition back to real timers does not automatically execute or preserve the state of pending fake timers [1]. When vi.useRealTimers is invoked, the underlying fake timer clock is uninstalled [1]. If you have scheduled timers that have not yet been executed, they are discarded because the fake environment that was tracking and managing them is removed [1][3]. To avoid unexpected behavior or side effects from lingering timers, it is standard practice to clean up pending timers before restoring real timers [4]. You can use the following methods to manage this: 1. vi.clearAllTimers: This explicitly cancels all currently scheduled timers [4][2]. 2. vi.runAllTimers: If you need those pending timers to execute before restoring real timers, you should run them to completion before calling vi.useRealTimers [5][4]. It is highly recommended to include vi.useRealTimers in an afterEach hook to ensure that fake timers do not leak into subsequent tests [4]. If your test environment experiences issues with console logs or hung processes due to timers, ensuring all timers are cleared or run before switching back to real timers is the standard resolution [5][4].
Citations:
- 1: https://github.com/vitest-dev/vitest/blob/main/packages/vitest/src/integrations/mock/timers.ts
- 2: https://github.com/supabase/supabase/blob/HEAD/.agents/skills/vitest/references/advanced-vi.md
- 3: https://main.vitest.dev/api/vi
- 4: https://brunosabot.dev/posts/2024/mastering-time-using-fake-timers-with-vitest/
- 5: https://github.com/vitest-dev/vitest/issues/1022
Drain pending timers before restoring real timers.
vi.useRealTimers()here can drop the fake-clock timers thatPromise.allSettled(invalidations)is waiting on. Keep fake timers active until the cleanup callbacks settle, then restore real timers in afinallyblock.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/vue-router/tests/pending-fallback-promise-replacement.test.tsx` around lines 13 - 18, Update the afterEach cleanup hook to drain and await all testCleanups while fake timers remain active, then restore real timers in a finally block so timer state is reset even if cleanup fails. Preserve the existing cleanup() call after the callbacks settle.github-actions[bot](GitHub profile, opens in a new tab) added labelsdocumentation
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/router-core/tests/preload-beforeload-reuse.test.ts (1)
222-280: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a same-route
loaderDepscase. This test only changes the parent match; it doesn’t cover reusing preloaded child context when the route’s own deps change.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/router-core/tests/preload-beforeload-reuse.test.ts` around lines 222 - 280, Extend the test around childBeforeLoad to add a same-route loaderDeps scenario where the child route’s own dependencies change between preload and navigation. Configure childRoute with loaderDeps and assert the preloaded child context is not reused, including updated context values and the expected preload flags.🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Inline comments: In `@packages/router-core/tests/preload-beforeload-reuse.test.ts`: - Around line 242-245: Update the regression case around loaderDeps and context to preserve type checking for the version contract: add a typed validateSearch definition for version, replace Record<string, any> with the inferred or explicit validated search type, and remove the as any casts around preloadRoute, navigate, and beforeLoad replacement by using typed route refresh helpers or a type-compatible mock. --- Nitpick comments: In `@packages/router-core/tests/preload-beforeload-reuse.test.ts`: - Around line 222-280: Extend the test around childBeforeLoad to add a same-route loaderDeps scenario where the child route’s own dependencies change between preload and navigation. Configure childRoute with loaderDeps and assert the preloaded child context is not reused, including updated context values and the expected preload flags.🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID:
beb16cf3-124d-4a1b-ae41-86535af7b3c1📥 Commits
Reviewing files that changed from the base of the PR and between adf73dd544d5663f12c1ec1995bcae3f0545d059 and 6f75f500232a57810b29846e21dc7ebd03fa8bbe.
📒 Files selected for processing (3)
docs/router/guide/preloading.mdpackages/router-core/src/load-client.tspackages/router-core/tests/preload-beforeload-reuse.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/router-core/src/load-client.ts
packages/router-core/tests/preload-beforeload-reuse.test.ts lines 242 to 245OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -0,0 +225,21 @@225+ context,226+ preload,227+ }: {228+ context: { version: number }229+ preload: boolean230+ }) => ({231+ childVersion: context.version,232+ }),233+ )234+ const rootRoute = new BaseRootRoute({})235+ const indexRoute = new BaseRoute({236+ getParentRoute: () => rootRoute,237+ path: '/',238+ })239+ const parentRoute = new BaseRoute({240+ getParentRoute: () => rootRoute,241+ path: '/parent',242+ loaderDeps: ({ search }: { search: Record<string, any> }) => ({243+ version: Number(search.version),244+ }),245+ context: ({ deps }: { deps: { version: number } }) => ({📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash set -euo pipefail file='packages/router-core/tests/preload-beforeload-reuse.test.ts' # Locate all explicit any escapes in this test. ast-grep run --pattern '$EXPR as any' --lang typescript "$file" rg -n '\bany\b' "$file" # Find established typed search-validation patterns in adjacent tests. rg -n -C8 --type ts 'validateSearch:|loaderDeps:' packages/router-core/testsRepository: TanStack/router
Length of output: 40432
🏁 Script executed:
#!/bin/bash set -euo pipefail file='packages/router-core/tests/preload-beforeload-reuse.test.ts' # Read the relevant sections around the flagged lines. sed -n '220,380p' "$file" # Look for local helpers or typed fixtures used in this file. rg -n -C4 'createTestRouter|as any|validateSearch|loaderDeps|beforeLoad|preloadRoute|navigate' "$file"Repository: TanStack/router
Length of output: 21621
🏁 Script executed:
#!/bin/bash set -euo pipefail # Find typed route-option replacement patterns and search validation in nearby tests. rg -n -C3 '_refreshRoute|options\.beforeLoad\s*=|validateSearch:' packages/router-core/tests/*.test.ts packages/router-core/tests/*.test-d.ts # Inspect the router test utilities for any helper that already handles route refreshes or typed route replacement. ast-grep outline packages/router-core/tests/routerTestUtils.ts --view expanded sed -n '1,260p' packages/router-core/tests/routerTestUtils.tsRepository: TanStack/router
Length of output: 16839
Keep this regression case type-checked.
Record<string, any>and theas anycasts aroundpreloadRoute/navigateandbeforeLoadreplacement bypass theversioncontract. Add a typedvalidateSearchforversion, then use typed route refresh helpers or assign a type-compatible mock directly.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/router-core/tests/preload-beforeload-reuse.test.ts` around lines 242 - 245, Update the regression case around loaderDeps and context to preserve type checking for the version contract: add a typed validateSearch definition for version, replace Record<string, any> with the inferred or explicit validated search type, and remove the as any casts around preloadRoute, navigate, and beforeLoad replacement by using typed route refresh helpers or a type-compatible mock.Source: Coding guidelines
✅ Addressed in commits 7b5436b to 90a7f39
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Inline comments: In `@packages/router-core/tests/hydration-currentness.test.ts`: - Around line 205-232: Extract the repeated mockWindow.$_TSR scaffolding in the hydration currentness tests into a helper such as mockDehydratedRouter, accepting only the matches array and preserving the shared manifest, dehydratedData, callbacks, buffer, and initialized values. Replace the duplicated setups at the referenced test blocks with this helper while keeping each test’s matches payload unchanged.🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID:
dae5e328-1744-4525-a06b-e2022da66f47📥 Commits
Reviewing files that changed from the base of the PR and between 6f75f500232a57810b29846e21dc7ebd03fa8bbe and f4b893487ccbe027821dfc6fc74d91dd98a5402f.
📒 Files selected for processing (10)
e2e/react-start/basic/src/routes/specialChars/search.tsxe2e/react-start/basic/tests/special-characters.spec.tspackages/react-router/src/Transitioner.tsxpackages/router-core/src/load-client.tspackages/router-core/src/router.tspackages/router-core/tests/hydrated-stay-match-data.test.tspackages/router-core/tests/hydration-currentness.test.tspackages/solid-router/src/Transitioner.tsxpackages/solid-router/tests/transitioner-render-ack.test.tsxpackages/vue-router/src/Transitioner.tsx
🚧 Files skipped from review as they are similar to previous changes (7)
- packages/solid-router/tests/transitioner-render-ack.test.tsx
- packages/react-router/src/Transitioner.tsx
- packages/router-core/tests/hydrated-stay-match-data.test.ts
- packages/solid-router/src/Transitioner.tsx
- packages/vue-router/src/Transitioner.tsx
- packages/router-core/src/load-client.ts
- packages/router-core/src/router.ts
packages/router-core/tests/hydration-currentness.test.ts lines 205 to 232OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -0,0 +212,21 @@212+ s: 'success',213+ ssr: true,214+ u: Date.now(),215+ },216+ {217+ i: oldMatches[1]!.id,218+ s: 'success',219+ ssr: 'data-only',220+ b: { source: 'old-server' },221+ l: 'old-server',222+ u: Date.now(),223+ },224+ ],225+ },226+ h: vi.fn(),227+ e: vi.fn(),228+ c: vi.fn(),229+ p: vi.fn(),230+ buffer: [],231+ initialized: false,232+ }📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Duplicate
mockWindow.$_TSRscaffolding across tests.Each test rebuilds an almost identical
{ router: { manifest, dehydratedData, matches: [...] }, h, e, c, p, buffer, initialized }shell, differing only in thematchespayload. Consider extracting a small helper (e.g.mockDehydratedRouter(matches)) that returns the boilerplate object, taking only thematchesarray as a parameter, to cut repetition across this (and likely other) tests in the file.♻️ Example helper extraction
function mockDehydratedRouter(matches: TsrSsrGlobal['router']['matches']) { return { router: { manifest: testManifest, dehydratedData: {}, matches }, h: vi.fn(), e: vi.fn(), c: vi.fn(), p: vi.fn(), buffer: [], initialized: false, } }Also applies to: 268-295, 325-351, 388-414
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/router-core/tests/hydration-currentness.test.ts` around lines 205 - 232, Extract the repeated mockWindow.$_TSR scaffolding in the hydration currentness tests into a helper such as mockDehydratedRouter, accepting only the matches array and preserving the shared manifest, dehydratedData, callbacks, buffer, and initialized values. Replace the duplicated setups at the referenced test blocks with this helper while keeping each test’s matches payload unchanged.✅ Addressed in commits 7b5436b to 90a7f39
Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud is proposing a fix for your failed CI:#
We suppress
SearchParamErrorandPathParamErrorinpreloadClientRoute's catch block to restore pre-PR behavior, where those errors propagated silently to the caller rather than being logged viaconsole.error. The E2E tests were failing because the test fixture captures all browser console errors, and the new catch block was incorrectly logging expected search-param validation failures that occur during route preloading.Warning
❌ We could not verify this fix.
Suggested Fix changes
diff --git a/packages/router-core/src/load-client.ts b/packages/router-core/src/load-client.ts index 9f625b89..3bcf2c99 100644 --- a/packages/router-core/src/load-client.ts +++ b/packages/router-core/src/load-client.ts @@ -3,7 +3,11 @@ import { isNotFound } from './not-found' import { isRedirect } from './redirect' import { loadRouteChunk } from './route-chunks' -import { getLocationChangeInfo } from './router' +import { + getLocationChangeInfo, + PathParamError, + SearchParamError, +} from './router' import type { ParsedLocation } from './location' import type { AnyRouteMatch } from './Matches' import type { NotFoundError } from './not-found' @@ -1556,7 +1560,11 @@ export async function preloadClientRoute( redirects + 1, ) } - if (!isNotFound(cause)) { + if ( + !isNotFound(cause) && + !(cause instanceof SearchParamError) && + !(cause instanceof PathParamError) + ) { console.error(cause) } if (matches!) {
Or Apply changes locally with:
Apply fix locally with your editor ↗ View interactive diff ↗npx nx-cloud apply-locally 78p0-6CYN
🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud has identified a possible root cause for your failed CI:#
We determined that the
tanstack-start-example-rscs:buildfailure is unrelated to this PR's changes — the project was not touched, and the error stems from a pre-existing version incompatibility betweennitro-nightlyand the installednitropackage, which does not export the./runtime/metasubpath. Our recommendation is to update or align thenitro/nitro-nightlyversions in the workspace to resolve this environment issue independently of this PR.No code changes were suggested for this issue.
Trigger a rerun:
View detailed reasoning on Nx Cloud ↗
🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud has identified a possible root cause for your failed CI:#
We classified this build failure as an environment issue rather than a code regression. The error (
ERR_PACKAGE_PATH_NOT_EXPORTEDfornitro's./runtime/metasubpath) originates in a third-party nightly dependency (nitro-nightly) and is unrelated to any source file changed in this PR. Our recommendation is to reconcile the installed versions ofnitroandnitro-nightlyin the workspace to resolve the incompatibility.No code changes were suggested for this issue.
Trigger a rerun:
View detailed reasoning on Nx Cloud ↗
🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud has identified a possible root cause for your failed CI:#
This CI failure appears to be related to the environment or external dependencies rather than your code changes.
No code changes were suggested for this issue.
Trigger a rerun:
View detailed reasoning on Nx Cloud ↗
🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud has identified a possible root cause for your failed CI:#
We identified that this build failure is unrelated to the PR's changes. The
tanstack-start-example-rscsexample fails becausenitro-nightly(a stale October 2025 nightly) attempts to import a./runtime/metasubpath that is no longer exported by the installednitropackage. This is a pre-existing dependency version incompatibility that needs to be resolved by updating or pinning thenitro-nightlydependency.No code changes were suggested for this issue.
Trigger a rerun:
View detailed reasoning on Nx Cloud ↗
🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud is proposing a fix for your failed CI:#
We corrected two symmetrical bugs in the AbortError handling introduced by the lane match loader rewrite. In
load-server.tsthe guard condition was inverted (using!signal.aborted), causing spontaneous loader AbortErrors to be silently swallowed as success instead of propagating as route failures; inload-client.tsthenormalizeErrorfallback returned[success, undefined]for every non-router-aborted AbortError becausestartFlighthad already handled the aborted case, making the success branch unreachable but harmful. Together these fixes ensure that only router-cancelled navigations discard AbortErrors as silent cancellations, while loader-own AbortErrors correctly surface as route errors.Warning
❌ We could not verify this fix.
diff --git a/packages/router-core/src/load-client.ts b/packages/router-core/src/load-client.ts index 465aab62..03c464e8 100644 --- a/packages/router-core/src/load-client.ts +++ b/packages/router-core/src/load-client.ts @@ -167,8 +167,8 @@ function normalizeError( cause: unknown, signal?: AbortSignal, ): LoaderOutcome { - if (signal && (cause as any)?.name === 'AbortError') { - return signal.aborted ? [canceled] : [success, undefined] + if (signal?.aborted && (cause as any)?.name === 'AbortError') { + return [canceled] } let outcome = normalize(cause, true, route.id) if (outcome[0] !== error) { diff --git a/packages/router-core/src/load-server.ts b/packages/router-core/src/load-server.ts index 341eef28..7327e9c2 100644 --- a/packages/router-core/src/load-server.ts +++ b/packages/router-core/src/load-server.ts @@ -321,7 +321,7 @@ function startLoader( } else { const failed = (cause: unknown): LoadOutcome => (cause as any)?.name === 'AbortError' && - !match.abortController.signal.aborted + match.abortController.signal.aborted ? [success, undefined] : normalizeError(route, cause) let value: unknown
Or Apply changes locally with:
Apply fix locally with your editor ↗ View interactive diff ↗npx nx-cloud apply-locally THxe-cCoh
🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)Important
A [new CI pipeline execution](https://cloud.nx.app/cipes/6a57884846f3b4b5f2deedbf) was requested that may update the conclusion below...Nx Cloud has identified a possible root cause for your failed CI:#
We identified the failure in
tanstack-react-start-e2e-basic:test:e2e--rsbuild-spaas an environment-level port conflict: both the dummy external server and the app server are configured to bind to port 43301, causing anEADDRINUSEerror unrelated to our code changes. Our PR only modifies UI components and test assertions, with no changes to server or port configuration, so this failure cannot be attributed to this PR.No code changes were suggested for this issue.
Trigger a rerun:
View detailed reasoning on Nx Cloud ↗
🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud is proposing a fix for your failed CI:#
We removed the
= undefinedinitializer fromdeclare isViewTransitionTypesSupported?: booleaninRouterCore, which caused TypeScript error TS1039 ("Initializers are not allowed in ambient contexts"). Thedeclaremodifier was introduced by the PR's byte-shaving commits to avoid unnecessary constructor overhead, but this one field was accidentally left with its initializer, breaking the build. Removing it aligns the field with its siblingdeclare shouldViewTransitionand with TypeScript's rules fordeclareclass members.Tip
✅ We verified this fix by re-running
@tanstack/router-core:build.diff --git a/packages/router-core/src/router.ts b/packages/router-core/src/router.ts index c7e3b451..78527402 100644 --- a/packages/router-core/src/router.ts +++ b/packages/router-core/src/router.ts @@ -1020,7 +1020,7 @@ export class RouterCore< reset?: boolean } = { next: true } declare shouldViewTransition?: boolean | ViewTransitionOptions - declare isViewTransitionTypesSupported?: boolean = undefined + declare isViewTransitionTypesSupported?: boolean subscribers = new Set<RouterListener<RouterEvent>>() declare _tx?: LoadTransaction declare _flights?: Map<string, LoaderFlight>
Or Apply changes locally with:
Apply fix locally with your editor ↗ View interactive diff ↗npx nx-cloud apply-locally fwy8-KL1O
🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud is proposing a fix for your failed CI:#
We removed the
declarekeyword from class fields inrouter.tsto fix a BabelSyntaxErrorthat occurred because@babel/plugin-transform-class-propertieswas running before@babel/plugin-transform-typescriptcould strip the ambient declarations. Convertingdeclare field?: Typetofield?: Typeis semantically identical at runtime while being fully compatible with all Babel transform orderings.Tip
✅ We verified this fix by re-running
tanstack-react-start-e2e-basic-scroll-restoration:test:e2e,tanstack-router-e2e-react-scroll-restoration-sandbox-vite:test:e2e,tanstack-react-start-e2e-dev-ssr-styles:test:e2e.Suggested Fix changes
diff --git a/packages/router-core/src/router.ts b/packages/router-core/src/router.ts index 81012284..0631210a 100644 --- a/packages/router-core/src/router.ts +++ b/packages/router-core/src/router.ts @@ -1014,23 +1014,23 @@ export class RouterCore< restoration?: boolean reset?: boolean } = { next: true } - declare shouldViewTransition?: boolean | ViewTransitionOptions - declare isViewTransitionTypesSupported?: boolean + shouldViewTransition?: boolean | ViewTransitionOptions + isViewTransitionTypesSupported?: boolean subscribers = new Set<RouterListener<RouterEvent>>() /** Current client load transaction and owner of navigation writes. */ - declare _tx?: LoadTransaction + _tx?: LoadTransaction /** Shared in-flight route loaders keyed by match ID. */ - declare _flights?: Map<string, LoaderFlight> + _flights?: Map<string, LoaderFlight> /** Last terminal matches, excluding temporary pending presentation. */ - declare _committedMatches?: Array<AnyRouteMatch> + _committedMatches?: Array<AnyRouteMatch> /** Pending-boundary reveal and minimum-visible timing state. */ - declare _pending?: PendingSession + _pending?: PendingSession /** Result of the latest server load, used to render or redirect. */ - declare _serverResult?: ServerLoadResult + _serverResult?: ServerLoadResult /** Framework callback that acknowledges the current matches rendered. (used to polyfill when the framework's `startTransition` does not return an awaitable promise) */ - declare _rendered?: () => void + _rendered?: () => void /** Development-only HMR reload for a route and its descendants. */ - declare _refreshRoute: ((routeId: string) => Promise<void>) | undefined + _refreshRoute?: (routeId: string) => Promise<void> // Must build in constructor stores!: RouterStores<TRouteTree>
Or Apply changes locally with:
Apply fix locally with your editor ↗ View interactive diff ↗npx nx-cloud apply-locally h6tT-ykGl
🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud is proposing a fix for your failed CI:#
We replaced all TypeScript
declareclass fields inRouterCorewith explicit= undefinedinitializers to fix the Babel transformation error occurring in the E2E test environments. Thedeclaremodifier requires@babel/plugin-transform-typescriptto run before@babel/plugin-transform-class-properties, but the workspace Babel config runs them in the opposite order, causing a hardSyntaxErrorthat prevented all three E2E tasks from starting. This change is semantically equivalent at runtime while restoring compatibility with the existing Babel plugin ordering.Tip
✅ We verified this fix by re-running
tanstack-react-start-e2e-basic-scroll-restoration:test:e2e,tanstack-router-e2e-react-scroll-restoration-sandbox-vite:test:e2e,tanstack-react-start-e2e-dev-ssr-styles:test:e2e.Suggested Fix changes
diff --git a/packages/router-core/src/router.ts b/packages/router-core/src/router.ts index 81012284..4480ae93 100644 --- a/packages/router-core/src/router.ts +++ b/packages/router-core/src/router.ts @@ -1014,23 +1014,23 @@ export class RouterCore< restoration?: boolean reset?: boolean } = { next: true } - declare shouldViewTransition?: boolean | ViewTransitionOptions - declare isViewTransitionTypesSupported?: boolean + shouldViewTransition?: boolean | ViewTransitionOptions = undefined + isViewTransitionTypesSupported?: boolean = undefined subscribers = new Set<RouterListener<RouterEvent>>() /** Current client load transaction and owner of navigation writes. */ - declare _tx?: LoadTransaction + _tx?: LoadTransaction = undefined /** Shared in-flight route loaders keyed by match ID. */ - declare _flights?: Map<string, LoaderFlight> + _flights?: Map<string, LoaderFlight> = undefined /** Last terminal matches, excluding temporary pending presentation. */ - declare _committedMatches?: Array<AnyRouteMatch> + _committedMatches?: Array<AnyRouteMatch> = undefined /** Pending-boundary reveal and minimum-visible timing state. */ - declare _pending?: PendingSession + _pending?: PendingSession = undefined /** Result of the latest server load, used to render or redirect. */ - declare _serverResult?: ServerLoadResult + _serverResult?: ServerLoadResult = undefined /** Framework callback that acknowledges the current matches rendered. (used to polyfill when the framework's `startTransition` does not return an awaitable promise) */ - declare _rendered?: () => void + _rendered?: () => void = undefined /** Development-only HMR reload for a route and its descendants. */ - declare _refreshRoute: ((routeId: string) => Promise<void>) | undefined + _refreshRoute: ((routeId: string) => Promise<void>) | undefined = undefined // Must build in constructor stores!: RouterStores<TRouteTree>
Or Apply changes locally with:
Apply fix locally with your editor ↗ View interactive diff ↗npx nx-cloud apply-locally bckt-yAnZ
🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud is proposing a fix for your failed CI:#
We removed the
declarekeyword from 9 class fields inrouter.tsto fix a Babel plugin ordering error that was crashing all three E2E test suites. Thedeclaresyntax requires@babel/plugin-transform-typescriptto run before@babel/plugin-transform-class-properties, an ordering that Playwright's Babel transform pipeline does not guarantee. Reverting to standard optional class field declarations (prop?: type) resolves theSyntaxErrorwithout changing runtime behavior.Tip
✅ We verified this fix by re-running
tanstack-react-start-e2e-basic-scroll-restoration:test:e2e,tanstack-router-e2e-react-scroll-restoration-sandbox-vite:test:e2e,tanstack-react-start-e2e-dev-ssr-styles:test:e2e.Suggested Fix changes
diff --git a/packages/router-core/src/router.ts b/packages/router-core/src/router.ts index 81012284..ca0650eb 100644 --- a/packages/router-core/src/router.ts +++ b/packages/router-core/src/router.ts @@ -1014,23 +1014,23 @@ export class RouterCore< restoration?: boolean reset?: boolean } = { next: true } - declare shouldViewTransition?: boolean | ViewTransitionOptions - declare isViewTransitionTypesSupported?: boolean + shouldViewTransition?: boolean | ViewTransitionOptions + isViewTransitionTypesSupported?: boolean subscribers = new Set<RouterListener<RouterEvent>>() /** Current client load transaction and owner of navigation writes. */ - declare _tx?: LoadTransaction + _tx?: LoadTransaction /** Shared in-flight route loaders keyed by match ID. */ - declare _flights?: Map<string, LoaderFlight> + _flights?: Map<string, LoaderFlight> /** Last terminal matches, excluding temporary pending presentation. */ - declare _committedMatches?: Array<AnyRouteMatch> + _committedMatches?: Array<AnyRouteMatch> /** Pending-boundary reveal and minimum-visible timing state. */ - declare _pending?: PendingSession + _pending?: PendingSession /** Result of the latest server load, used to render or redirect. */ - declare _serverResult?: ServerLoadResult + _serverResult?: ServerLoadResult /** Framework callback that acknowledges the current matches rendered. (used to polyfill when the framework's `startTransition` does not return an awaitable promise) */ - declare _rendered?: () => void + _rendered?: () => void /** Development-only HMR reload for a route and its descendants. */ - declare _refreshRoute: ((routeId: string) => Promise<void>) | undefined + _refreshRoute: ((routeId: string) => Promise<void>) | undefined // Must build in constructor stores!: RouterStores<TRouteTree>
Or Apply changes locally with:
Apply fix locally with your editor ↗ View interactive diff ↗npx nx-cloud apply-locally aGSy-kgb4
🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: react-start-client
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: solid-start-client
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-plugin-core
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-client-core
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: vue-start-client
Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud is proposing a fix for your failed CI:#
We updated two stale HMR snapshots (
createFileRoute-lowercase-components@true.tsxandcreateRootRoute-lowercase-components@true.tsx) and replaced the undefinedgetReferenceRouteCompilerPluginsreference in the test file with the already-importedgetFrameworkHmrCompilerPlugins. These changes align the test fixtures with the simplifiedhandleRouteUpdateimplementation introduced by the lane match loader rewrite, resolving both the snapshot mismatches and theReferenceError/TS2304type error.Tip
✅ We verified this fix by re-running
@tanstack/router-plugin:test:unit,@tanstack/router-plugin:test:types.Warning
The suggested diff is too large to display here, but you can view it on Nx Cloud ↗
Or Apply changes locally with:
Apply fix locally with your editor ↗ View interactive diff ↗npx nx-cloud apply-locally k8RL-Il32
🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)Actionable comments posted: 2
🧹 Nitpick comments (1)
e2e/react-router/issue-7120/package.json (1)
14-21: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winResolve the internal workspace protocol before merging.
These internal dependencies use
workspace:^, while the current coding guideline requiresworkspace:*. The supplied repository learning states that e2e applications conventionally useworkspace:^, so please confirm which policy governs this PR. If the current guideline is authoritative, update all three ranges:Proposed fix
- "`@tanstack/react-router`": "workspace:^", - "`@tanstack/router-plugin`": "workspace:^", + "`@tanstack/react-router`": "workspace:*", + "`@tanstack/router-plugin`": "workspace:*", ... - "`@tanstack/router-e2e-utils`": "workspace:^", + "`@tanstack/router-e2e-utils`": "workspace:*",As per coding guidelines, internal dependencies in
package.jsonmust useworkspace:*; based on learnings, e2e apps conventionally useworkspace:^, so this policy conflict needs explicit resolution.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@e2e/react-router/issue-7120/package.json` around lines 14 - 21, Resolve the policy conflict for internal workspace dependencies in this package: confirm whether the current guideline or the e2e convention governs this PR, then update all three workspace ranges in the package manifest to the authoritative protocol, using workspace:* if the guideline applies.Sources: Coding guidelines, Learnings
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Inline comments: In @.changeset/lane-match-loader-rewrite.md: - Around line 2-5: Update the changeset release levels for `@tanstack/router-core`, `@tanstack/react-router`, `@tanstack/solid-router`, and `@tanstack/vue-router` from patch to major to reflect the removed public members and changed StartTransitionFn signature. In `@e2e/react-router/issue-7457/src/main.tsx`: - Around line 21-25: Declare the ambient __pendingSeen flag in e2e/react-router/issue-7457/src/vite-env.d.ts, then replace the any-cast global access in DefaultPendingComponent within e2e/react-router/issue-7457/src/main.tsx and the corresponding test access in e2e/react-router/issue-7457/tests/issue-7457.repro.spec.ts with direct globalThis.__pendingSeen usage. --- Nitpick comments: In `@e2e/react-router/issue-7120/package.json`: - Around line 14-21: Resolve the policy conflict for internal workspace dependencies in this package: confirm whether the current guideline or the e2e convention governs this PR, then update all three workspace ranges in the package manifest to the authoritative protocol, using workspace:* if the guideline applies.🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID:
51034e37-ca80-4e45-ba7e-ca5dbe8df417📥 Commits
Reviewing files that changed from the base of the PR and between f4b893487ccbe027821dfc6fc74d91dd98a5402f and a4d5b8ffd88efae190d565cfc9ccafac44e3b4d3.
📒 Files selected for processing (46)
.changeset/lane-match-loader-rewrite.mdbenchmarks/memory/server/scenarios/aborted-requests/shared.tsdocs/router/api/router/RouteMatchType.mddocs/router/api/router/RouteOptionsType.mddocs/router/api/router/RouterOptionsType.mddocs/router/api/router/RouterStateType.mddocs/router/api/router/RouterType.mddocs/router/api/router/useChildMatchesHook.mddocs/router/api/router/useMatchesHook.mddocs/router/api/router/useParentMatchesHook.mddocs/router/guide/data-loading.mddocs/router/guide/path-params.mddocs/router/guide/preloading.mddocs/router/how-to/debug-router-issues.mde2e/react-router/issue-7120/index.htmle2e/react-router/issue-7120/package.jsone2e/react-router/issue-7120/playwright.config.tse2e/react-router/issue-7120/src/main.tsxe2e/react-router/issue-7120/src/redirectGate.tse2e/react-router/issue-7120/src/routeTree.gen.tse2e/react-router/issue-7120/src/routes/__root.tsxe2e/react-router/issue-7120/src/routes/index.tsxe2e/react-router/issue-7120/src/routes/posts.lazy.tsxe2e/react-router/issue-7120/src/routes/posts.tsxe2e/react-router/issue-7120/src/vite-env.d.tse2e/react-router/issue-7120/tests/issue-7120.repro.spec.tse2e/react-router/issue-7120/tsconfig.jsone2e/react-router/issue-7120/vite.config.tse2e/react-router/issue-7457/index.htmle2e/react-router/issue-7457/package.jsone2e/react-router/issue-7457/playwright.config.tse2e/react-router/issue-7457/src/main.tsxe2e/react-router/issue-7457/src/routeTree.gen.tse2e/react-router/issue-7457/src/routes/__root.tsxe2e/react-router/issue-7457/src/routes/another.tsxe2e/react-router/issue-7457/src/routes/index.tsxe2e/react-router/issue-7457/src/vite-env.d.tse2e/react-router/issue-7457/tests/issue-7457.repro.spec.tse2e/react-router/issue-7457/tsconfig.jsone2e/react-router/issue-7457/vite.config.jse2e/react-router/scroll-restoration-sandbox-vite/tests/app.spec.tse2e/react-start/selective-ssr/src/routes/__root.tsxe2e/react-start/selective-ssr/tests/app.spec.tse2e/solid-start/selective-ssr/dev-server.tse2e/solid-start/selective-ssr/playwright.config.tse2e/solid-start/selective-ssr/tests/issue-7283-dev-hydration.spec.ts
@@ -0,0 +1,5 @@1+---2+'@tanstack/router-core': patch3+'@tanstack/react-router': patch4+'@tanstack/solid-router': patch5+'@tanstack/vue-router': patch🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash set -euo pipefail echo "== changeset file ==" cat -n .changeset/lane-match-loader-rewrite.md echo echo "== repo files mentioning semver / changeset / major release ==" rg -n --hidden --glob '!**/node_modules/**' --glob '!**/.git/**' -e 'semver|major release|patch release|changeset' README* .changeset docs . 2>/dev/null | head -n 200Repository: TanStack/router
Length of output: 18706
🏁 Script executed:
#!/bin/bash set -euo pipefail echo "== file list around changesets ==" git ls-files '.changeset/*' | sed -n '1,120p' echo echo "== outline of the referenced changeset ==" wc -l .changeset/lane-match-loader-rewrite.md sed -n '1,120p' .changeset/lane-match-loader-rewrite.mdRepository: TanStack/router
Length of output: 3407
🏁 Script executed:
#!/bin/bash set -euo pipefail echo "== .changeset/config.json ==" cat -n .changeset/config.json echo echo "== docs / config mentioning patch or major policy ==" rg -n --hidden --glob '!**/node_modules/**' --glob '!**/.git/**' -e 'patch.*major|major.*patch|breaking.*patch|changeset.*patch|changeset.*major|semver policy|version policy|breaking change' .changeset docs README* package.json .github . 2>/dev/null | head -n 200Repository: TanStack/router
Length of output: 16531
Use a major changeset for the API removals. The affected sections remove public members and change
StartTransitionFn’s signature, so patch release metadata is inconsistent with the documented breaking surface.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.changeset/lane-match-loader-rewrite.md around lines 2 - 5, Update the changeset release levels for `@tanstack/router-core`, `@tanstack/react-router`, `@tanstack/solid-router`, and `@tanstack/vue-router` from patch to major to reflect the removed public members and changed StartTransitionFn signature.@@ -0,0 +5,21 @@5+import { routeTree } from './routeTree.gen'6+7+const queryClient = new QueryClient()8+const router = createRouter({9+ routeTree,10+ context: { queryClient },11+ defaultPendingComponent: DefaultPendingComponent,12+ defaultPreloadStaleTime: 0,13+})14+15+declare module '@tanstack/react-router' {16+ interface Register {17+ router: typeof router18+ }19+}20+21+function DefaultPendingComponent() {22+ useEffect(() => {23+ ;(globalThis as any).__pendingSeen = true24+ }, [])25+ return <div data-testid="app-pending">loading</div>📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash fd '^tsconfig\.json$' e2e/react-router/issue-7457 -x sh -c ' echo "--- $1" sed -n "1,220p" "$1" ' sh {} rg -n --glob '*.{ts,tsx,d.ts}' \ '\(globalThis as any\)\.__pendingSeen|declare global|__pendingSeen' \ e2e/react-router/issue-7457Repository: TanStack/router
Length of output: 756
🏁 Script executed:
#!/bin/bash set -euo pipefail echo "--- files" git ls-files e2e/react-router/issue-7457 echo echo "--- declaration/global matches" rg -n --glob 'e2e/react-router/issue-7457/**/*.{ts,tsx,d.ts}' \ 'declare global|interface Window|__pendingSeen|globalThis as any' \ e2e/react-router/issue-7457 echo echo "--- tsconfig files" fd 'tsconfig\.json$' e2e/react-router/issue-7457 -x sh -c ' echo "### $1" sed -n "1,220p" "$1" ' sh {}Repository: TanStack/router
Length of output: 1377
🏁 Script executed:
#!/bin/bash set -euo pipefail echo "--- vite-env.d.ts" cat -n e2e/react-router/issue-7457/src/vite-env.d.ts echo echo "--- package.json" cat -n e2e/react-router/issue-7457/package.json echo echo "--- playwright.config.ts" cat -n e2e/react-router/issue-7457/playwright.config.tsRepository: TanStack/router
Length of output: 2095
Declare
__pendingSeeninstead of castingglobalThistoany. Add the ambient flag declaration ine2e/react-router/issue-7457/src/vite-env.d.ts, then useglobalThis.__pendingSeendirectly ine2e/react-router/issue-7457/src/main.tsxande2e/react-router/issue-7457/tests/issue-7457.repro.spec.ts.📍 Affects 2 files
e2e/react-router/issue-7457/src/main.tsx#L21-L25(this comment)e2e/react-router/issue-7457/tests/issue-7457.repro.spec.ts#L29-L31
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@e2e/react-router/issue-7457/src/main.tsx` around lines 21 - 25, Declare the ambient __pendingSeen flag in e2e/react-router/issue-7457/src/vite-env.d.ts, then replace the any-cast global access in DefaultPendingComponent within e2e/react-router/issue-7457/src/main.tsx and the corresponding test access in e2e/react-router/issue-7457/tests/issue-7457.repro.spec.ts with direct globalThis.__pendingSeen usage.Source: Coding guidelines
🧹 Nitpick comments (1)
packages/router-core/src/load-client.ts (1)
456-463: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMutating lease decrement inside the guard is easy to misread.
--flight[2]both decrements and drives control flow, and an already-zero lease (reserved bytransferPredecessorResources) would underflow to-1and silently keep the registry entry. Consider making the reservation state explicit.♻️ Suggested clarification
- if (!flight || --flight[2]) { + if (!flight) { + return + } + if (process.env.NODE_ENV !== 'production' && flight[2] < 1) { + throw new Error('Invariant failed: releasing a flight without a lease') + } + if (--flight[2]) { return }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/router-core/src/load-client.ts` around lines 456 - 463, Update releaseOwnedFlight so the lease decrement is performed explicitly before the guard, and handle an already-zero lease as a reserved state without underflowing or retaining the registry entry. Preserve the existing early return for missing flights and only release/delete the owned flight when the resulting lease count indicates it is no longer reserved.🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Nitpick comments: In `@packages/router-core/src/load-client.ts`: - Around line 456-463: Update releaseOwnedFlight so the lease decrement is performed explicitly before the guard, and handle an already-zero lease as a reserved state without underflowing or retaining the registry entry. Preserve the existing early return for missing flights and only release/delete the owned flight when the resulting lease count indicates it is no longer reserved.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID:
0aebeb69-11ac-4054-a1d1-fbf438a22719📥 Commits
Reviewing files that changed from the base of the PR and between 2d639e1707f8017a5f250336c56a1847808a72e6 and 1d20a9dc9c69cab6d7096b760e471d2aff2f22f7.
📒 Files selected for processing (17)
docs/router/api/router/RouterType.mddocs/router/guide/preloading.mdpackages/react-router/src/Transitioner.tsxpackages/router-core/INTERNALS.mdpackages/router-core/src/load-client.tspackages/router-core/src/router.tspackages/router-core/tests/issue-3928-rapid-reload-abort.test.tspackages/router-core/tests/issue-6371-search-default-normalization-abort.test.tspackages/router-core/tests/load.test.tspackages/router-core/tests/loader-architecture-regressions.test.tspackages/router-core/tests/preload-adoption.test.tspackages/router-core/tests/preload-beforeload-reuse.test.tspackages/router-core/tests/preload-navigation-adoption.test.tspackages/router-core/tests/preload-public-cache-behavior.test.tspackages/router-core/tests/public-hydration-contract.test.tspackages/router-core/tests/public-preload-lane-contract.test.tspackages/router-core/tests/same-destination-navigation-join.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- docs/router/guide/preloading.md
- docs/router/api/router/RouterType.md
- packages/router-core/tests/preload-beforeload-reuse.test.ts
Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud has identified a possible root cause for your failed CI:#
We determined this failure is an environment state issue rather than a code regression. The error originates from a stale compiled dist artifact (
e2e/e2e-utils/dist/esm/e2eSetupTeardown.js) that was missing thee2eStartDummyServerexport at test execution time, even though the source file correctly defines it and the PR makes no changes to e2e-utils. The dist has since been rebuilt correctly, confirming this was a build ordering issue in the CI environment.No code changes were suggested for this issue.
Trigger a rerun:
View detailed reasoning on Nx Cloud ↗
🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)🧹 Nitpick comments (2)
packages/router-plugin/tests/handle-route-update.test.ts (1)
603-606: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAvoid unchecked
anyfor the React act global.Use a typed
globalThisextension so writes toIS_REACT_ACT_ENVIRONMENTremain type-checked. As per coding guidelines, “Use TypeScript strict mode with extensive type safety.”Proposed fix
+const testGlobal = globalThis as typeof globalThis & { + IS_REACT_ACT_ENVIRONMENT?: boolean +} + - delete (globalThis as any).IS_REACT_ACT_ENVIRONMENT + delete testGlobal.IS_REACT_ACT_ENVIRONMENT ... - ;(globalThis as any).IS_REACT_ACT_ENVIRONMENT = previousActEnvironment + testGlobal.IS_REACT_ACT_ENVIRONMENT = previousActEnvironment🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/router-plugin/tests/handle-route-update.test.ts` around lines 603 - 606, Replace the unchecked globalThis casts in the IS_REACT_ACT_ENVIRONMENT restoration logic with a typed globalThis extension, declaring the optional React act environment property in the appropriate global type scope. Keep the existing delete behavior for undefined values and assignment behavior for saved values while ensuring both writes remain type-checked.Source: Coding guidelines
packages/start-server-core/tests/createStartHandler.test.ts (1)
577-583: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract repeated
onTestFinishedcleanup pair into a shared helper.The
consoleError.mockRestore()+router.serverSsr?.cleanup()pair is duplicated verbatim across this and (per the change-details) many other cancellation tests in this file. A small helper (e.g.registerCancellationCleanup(router, consoleError)) called once per test would reduce repetition and keep future changes to the cleanup sequence in one place.♻️ Suggested helper
function registerCancellationCleanup( router: AnyRouter, consoleError: ReturnType<typeof vi.spyOn>, ) { onTestFinished(() => { consoleError.mockRestore() }) onTestFinished(() => { router.serverSsr?.cleanup() }) }Then in each test:
- onTestFinished(() => { - consoleError.mockRestore() - }) - onTestFinished(() => { - router.serverSsr?.cleanup() - }) + registerCancellationCleanup(router, consoleError)Also applies to: 641-646
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/start-server-core/tests/createStartHandler.test.ts` around lines 577 - 583, Extract the duplicated consoleError.mockRestore and router.serverSsr?.cleanup registrations into a shared registerCancellationCleanup helper near the test utilities, accepting the router and spy arguments. Replace both cancellation-test cleanup pairs, including the occurrences around the referenced tests, with one helper call per test while preserving cleanup order and behavior.🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Nitpick comments: In `@packages/router-plugin/tests/handle-route-update.test.ts`: - Around line 603-606: Replace the unchecked globalThis casts in the IS_REACT_ACT_ENVIRONMENT restoration logic with a typed globalThis extension, declaring the optional React act environment property in the appropriate global type scope. Keep the existing delete behavior for undefined values and assignment behavior for saved values while ensuring both writes remain type-checked. In `@packages/start-server-core/tests/createStartHandler.test.ts`: - Around line 577-583: Extract the duplicated consoleError.mockRestore and router.serverSsr?.cleanup registrations into a shared registerCancellationCleanup helper near the test utilities, accepting the router and spy arguments. Replace both cancellation-test cleanup pairs, including the occurrences around the referenced tests, with one helper call per test while preserving cleanup order and behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID:
92fb7592-301b-4518-bb89-d03cef737520📥 Commits
Reviewing files that changed from the base of the PR and between 1d20a9dc9c69cab6d7096b760e471d2aff2f22f7 and b8204ea9adaeaabde7f8def033749afb67648f02.
📒 Files selected for processing (25)
packages/react-router/tests/issue-4467-lazy-route-pending.test.tsxpackages/react-router/tests/issue-4476-react-query-cancellation.test.tsxpackages/react-router/tests/issue-4759-pending-frame.test.tsxpackages/react-router/tests/issue-6371-search-default-normalization-abort.test.tsxpackages/react-router/tests/preloaded-mount-resolution.test.tsxpackages/react-router/tests/renderRouterToStream.test.tsxpackages/router-core/tests/hmr-refresh-lifecycle.test.tspackages/router-core/tests/hydration-currentness.test.tspackages/router-core/tests/issue-4078-loader-notfound-root-boundary.test.tspackages/router-core/tests/issue-5427-hydration-root-global-not-found.test.tspackages/router-core/tests/issue-6221-head-waits-for-loader.test.tspackages/router-core/tests/issue-7602-parent-beforeload-context-child-loader.test.tspackages/router-core/tests/issue-7759-in-flight-preload-eviction.test.tspackages/router-core/tests/public-hydration-contract.test.tspackages/router-core/tests/public-preload-lane-contract.test.tspackages/router-core/tests/server-chunk-failure-lifecycle.test.tspackages/router-core/tests/ssr-server-cleanup.test.tspackages/router-plugin/tests/handle-route-update.test.tspackages/solid-router/tests/createLazyRoute.test.tsxpackages/solid-router/tests/errorComponent.test.tsxpackages/solid-router/tests/transitioner-listener-errors.test.tsxpackages/solid-router/tests/transitioner-render-ack.test.tsxpackages/start-server-core/tests/createStartHandler.test.tspackages/vue-router/tests/Transitioner.test.tsxpackages/vue-router/tests/transitioner-listener-errors.test.tsx
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/react-router/src/Transitioner.tsx (1)
89-101: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winSettle any existing owner before pushing the mount acknowledgement.
Line 20 reuses an existing array with
router._rendered ??= []. Lines 94-101 push two entries without checking the current length. Ifacknowledgementalready holds anexpected/settlepair, the push writes to indexes 2 and 3.settleOwnerthen reads the stale entry at index 1, andMatchesInnerreads the stale offered value at index 0.The effect can run again because its dependencies are
[router, router.history], and in productionmountedisundefined, so the guard at lines 56-61 does not stop the second run.🛡️ Proposed fix
if ( resolvedLocation?.href === location.href && resolvedLocation.state.__TSR_key === location.state.__TSR_key ) { + settleOwner(acknowledgement, false) acknowledgement.push(router.stores.matches.get(), (rendered) => {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/react-router/src/Transitioner.tsx` around lines 89 - 101, Before pushing the new expected/settle pair in the resolved-location branch, settle or clear any existing owner held by the reused acknowledgement array. Update the acknowledgement handling around router._rendered, settleOwner, and the acknowledgement.push call so repeated effect runs replace the prior pair rather than appending at indexes 2 and 3, while preserving the existing onRendered behavior.🧹 Nitpick comments (3)
packages/react-router/tests/react-render-owner-contract.test.tsx (1)
69-75: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAttach a rejection handler to
firstNavigation.Line 70 registers only a fulfillment handler. If
firstNavigationrejects, Node reports an unhandled rejection, and the failure appears as noise instead of a clear assertion failure. The test name states that the navigation settles, so record both outcomes.♻️ Proposed change
const firstSettled = vi.fn() - void firstNavigation.then(firstSettled) + void firstNavigation.then(firstSettled, firstSettled)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/react-router/tests/react-render-owner-contract.test.tsx` around lines 69 - 75, Update the firstNavigation settlement tracking in the test to register both fulfillment and rejection handlers, while preserving the existing firstSettled assertion and rendered-state checks. Ensure either outcome marks the navigation as settled without leaving a rejected promise unhandled.packages/react-router/src/Transitioner.tsx (1)
27-49: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider moving the
startTransitionassignment out of the render body.Lines 27 and 49 mutate
routerduring render. React 19 can render a component more than once before commit, and Strict Mode does this in development. The assignment is idempotent here, so the current behavior is correct. AuseLayoutEffector a module-level registration keeps the render function pure and avoids future regressions if the closure starts to capture render-scoped state.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/react-router/src/Transitioner.tsx` around lines 27 - 49, Move the router.startTransition assignment and development-only _cancelTransition registration out of the render body into a useLayoutEffect or module-level registration. Preserve the existing acknowledgement handling, error rejection, and production/development behavior while ensuring render remains free of router mutations.packages/router-core/tests/load.test.ts (1)
461-489: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueOptional: merge the two shared-preload tests with
test.each.The two tests differ only in the thrown value and the expected match state. A
test.eachtable keeps the shared-loader contract in one place and prevents the two copies from drifting.Also applies to: 541-567
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/router-core/tests/load.test.ts` around lines 461 - 489, Merge the two shared-preload navigation tests, including the case around the pending preload loader and the corresponding test near the referenced range, into a single test.each table. Parameterize the thrown loader value and expected match state while keeping the shared setup, synchronization, navigation, and loader-call assertions in one test body.🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Inline comments: In `@packages/react-router/src/Transitioner.tsx`: - Around line 31-44: Unify the production and development branches around the transition callback so synchronous errors from fn() use the same cleanup path. Update the React.startTransition handling near acknowledgement and resolve to clear acknowledgement when the current settle entry matches, then reject the error, while preserving normal transition execution in both modes. --- Outside diff comments: In `@packages/react-router/src/Transitioner.tsx`: - Around line 89-101: Before pushing the new expected/settle pair in the resolved-location branch, settle or clear any existing owner held by the reused acknowledgement array. Update the acknowledgement handling around router._rendered, settleOwner, and the acknowledgement.push call so repeated effect runs replace the prior pair rather than appending at indexes 2 and 3, while preserving the existing onRendered behavior. --- Nitpick comments: In `@packages/react-router/src/Transitioner.tsx`: - Around line 27-49: Move the router.startTransition assignment and development-only _cancelTransition registration out of the render body into a useLayoutEffect or module-level registration. Preserve the existing acknowledgement handling, error rejection, and production/development behavior while ensuring render remains free of router mutations. In `@packages/react-router/tests/react-render-owner-contract.test.tsx`: - Around line 69-75: Update the firstNavigation settlement tracking in the test to register both fulfillment and rejection handlers, while preserving the existing firstSettled assertion and rendered-state checks. Ensure either outcome marks the navigation as settled without leaving a rejected promise unhandled. In `@packages/router-core/tests/load.test.ts`: - Around line 461-489: Merge the two shared-preload navigation tests, including the case around the pending preload loader and the corresponding test near the referenced range, into a single test.each table. Parameterize the thrown loader value and expected match state while keeping the shared setup, synchronization, navigation, and loader-call assertions in one test body.🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID:
662b8b96-2fc6-4884-8943-f632ab7b0ad7📥 Commits
Reviewing files that changed from the base of the PR and between b8204ea9adaeaabde7f8def033749afb67648f02 and 00d68c45729b6ec1b5d2f64543e52751bdbf7f58.
📒 Files selected for processing (27)
e2e/react-start/basic/src/routeTree.gen.tse2e/react-start/basic/src/routes/issue-6221.article.$id.tsxe2e/react-start/basic/src/routes/issue-6221.dashboard.tsxe2e/react-start/basic/tests/issue-6221-head.spec.tse2e/react-start/hmr/tests/app.spec.tspackages/react-router/src/Matches.tsxpackages/react-router/src/Transitioner.tsxpackages/react-router/tests/component-preload-retry.test.tsxpackages/react-router/tests/react-render-owner-contract.test.tsxpackages/router-core/INTERNALS.mdpackages/router-core/src/load-client.tspackages/router-core/src/router.tspackages/router-core/tests/boundary-component-chunk.test.tspackages/router-core/tests/hydration-boundary-chunks.test.tspackages/router-core/tests/issue-3928-rapid-reload-abort.test.tspackages/router-core/tests/load.test.tspackages/router-core/tests/loader-architecture-regressions.test.tspackages/router-core/tests/preflight-signal-currentness.test.tspackages/router-core/tests/preload-adoption.test.tspackages/router-core/tests/preload-public-signal-lifetime.test.tspackages/router-core/tests/public-client-loading-contract.test.tspackages/router-core/tests/public-preload-lane-contract.test.tspackages/router-core/tests/same-destination-navigation-join.test.tspackages/solid-router/src/awaited.tsxpackages/solid-router/tests/createLazyRoute.test.tsxpackages/vue-router/src/Match.tsxpackages/vue-router/src/awaited.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/router-core/tests/hydration-boundary-chunks.test.ts
- packages/solid-router/tests/createLazyRoute.test.tsx
- packages/router-core/tests/preload-adoption.test.ts
packages/react-router/src/Transitioner.tsx lines 31 to 44OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -30,0 +24,21 @@24+ React.useRef(false)25+ : undefined26+27+ router.startTransition = (fn, expected) =>28+ new Promise((resolve, reject) => {29+ settleOwner(acknowledgement, false)30+ acknowledgement.push(expected, resolve)31+ if (process.env.NODE_ENV === 'production') {32+ React.startTransition(fn)33+ } else {34+ React.startTransition(() => {35+ try {36+ fn()37+ } catch (cause) {38+ if (acknowledgement[1 /* settle */] === resolve) {39+ acknowledgement.length = 040+ }41+ reject(cause)42+ }43+ })44+ }🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Clear the acknowledgement tuple when
fn()throws in production.The development branch wraps
fn()intry/catchand clearsacknowledgementwhen the pending settle is still the current one. The production branch passesfndirectly toReact.startTransition.React.startTransitionrethrows a synchronous error from the scope function, so thePromiseexecutor rejects the returned promise. The tuple, however, keeps the staleexpectedvalue and the staleresolve.A stale
expectedvalue stays visible toMatchesInner, which usesacknowledgement[0]as the store snapshot. The UI then keeps rendering the stale offered matches until the nextstartTransitioncall. Use one code path for both modes.🐛 Proposed fix to unify the error path
router.startTransition = (fn, expected) => new Promise((resolve, reject) => { settleOwner(acknowledgement, false) acknowledgement.push(expected, resolve) - if (process.env.NODE_ENV === 'production') { - React.startTransition(fn) - } else { - React.startTransition(() => { - try { - fn() - } catch (cause) { - if (acknowledgement[1 /* settle */] === resolve) { - acknowledgement.length = 0 - } - reject(cause) - } - }) - } + React.startTransition(() => { + try { + fn() + } catch (cause) { + if (acknowledgement[1 /* settle */] === resolve) { + acknowledgement.length = 0 + } + reject(cause) + } + }) })📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
Suggested change31- if (process.env.NODE_ENV === 'production') {32- React.startTransition(fn)33- } else {34- React.startTransition(() => {35- try {36- fn()37- } catch (cause) {38- if (acknowledgement[1 /* settle */] === resolve) {39- acknowledgement.length = 040- }41- reject(cause)42- }43- })44- }31+ React.startTransition(() => {32+ try {33+ fn()34+ } catch (cause) {35+ if (acknowledgement[1 /* settle */] === resolve) {36+ acknowledgement.length = 037+ }38+ reject(cause)39+ }40+ })🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/react-router/src/Transitioner.tsx` around lines 31 - 44, Unify the production and development branches around the transition callback so synchronous errors from fn() use the same cleanup path. Update the React.startTransition handling near acknowledgement and resolve to clear acknowledgement when the current settle entry matches, then reject the error, while preserving normal transition execution in both modes.✅ Addressed in commit 1c28ed7
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. Inline comments: In `@packages/react-router/tests/transitioner-render-ack.test.tsx`: - Around line 65-75: Update the navigation promise handling around router.navigate so rejected navigations are not converted into a resolved promise: track settlement without attaching a rejection handler that swallows the error, then await navigation and allow its rejection to propagate while preserving the existing settled assertion.🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID:
b4ebad96-425f-4dc7-8961-9d5bfefd4bbf📥 Commits
Reviewing files that changed from the base of the PR and between 00d68c45729b6ec1b5d2f64543e52751bdbf7f58 and 1c28ed70135cfa60ff06a23915b66242f93b0d67.
📒 Files selected for processing (2)
packages/react-router/src/Transitioner.tsxpackages/react-router/tests/transitioner-render-ack.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/react-router/src/Transitioner.tsx
@@ -21,0 +55,21 @@55+ if (event.error === error) {56+ globalReport()57+ event.preventDefault()58+ }59+ }60+ window.addEventListener('error', preventGlobalReport)61+ testCleanups.push(() => {62+ window.removeEventListener('error', preventGlobalReport)63+ })64+65+ let settled = false66+ const navigation = router.navigate({ to: '/next' }).then(67+ () => {68+ settled = true69+ },70+ () => {71+ settled = true72+ },73+ )74+ await waitFor(() => expect(settled).toBe(true))75+ await navigation🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Do not swallow a rejected navigation promise.
The rejection handler marks
settledand resolvesnavigation. This test passes ifrouter.navigaterejects after the route renders. Let the awaited navigation reject so the test enforces the required contract.Proposed fix
- let settled = false - const navigation = router.navigate({ to: '/next' }).then( - () => { - settled = true - }, - () => { - settled = true - }, - ) - await waitFor(() => expect(settled).toBe(true)) - await navigation + await router.navigate({ to: '/next' })📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
Suggested change65- let settled = false66- const navigation = router.navigate({ to: '/next' }).then(67- () => {68- settled = true69- },70- () => {71- settled = true72- },73- )74- await waitFor(() => expect(settled).toBe(true))75- await navigation65+ await router.navigate({ to: '/next' })🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/react-router/tests/transitioner-render-ack.test.tsx` around lines 65 - 75, Update the navigation promise handling around router.navigate so rejected navigations are not converted into a resolved promise: track settlement without attaching a rejection handler that swallows the error, then await navigation and allow its rejection to propagate while preserving the existing settled assertion.Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud has identified a possible root cause for your failed CI:#
We identified the failure in
tanstack-react-start-e2e-rsc:test:e2e--rsbuild-ssr--shard-4-of-6as an environment state issue: the Playwright external test server could not bind to port 32795 (EADDRINUSE), indicating another process was already occupying that port at the time of the run. Our analysis confirmed no connection to this PR's router core changes, and no similar failures were found in other branches, pointing to a transient CI infrastructure condition that should resolve on a rerun.No code changes were suggested for this issue.
Trigger a rerun:
View detailed reasoning on Nx Cloud ↗
🎓 Learn more about Self-Healing CI on [nx.dev](https://nx.dev/docs/features/ci-features/self-healing-ci?utm_source=pull-request&utm_medium=comment)Sheraff(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
View your CI Pipeline Execution ↗ for commit 27d10cb584ef74dc46e70e01713806b2c0dc7802
nx affected --targets=test:eslint,test:unit,tes...nx run-many --target=build --exclude=examples/*...☁️ Nx Cloud last updated this comment at
2026-08-04 11:45:02UTC