fix(router-core): avoid preload cleanup crashes after invalidation #7003
main fromopencode/shiny-orchid·opened Summary#
- harden
loadRouteMatchso preload cleanup does not crash when an in-flight match has already been evicted from cache - add regression coverage for both direct cache GC and
router.invalidate()clearing an in-flight preload - keep the current behavior where expired preloads may be removed, while preventing the
_nonReactiveconsole error reported after the recent preload changes
Testing#
CI=1 NX_DAEMON=false pnpm nx run @tanstack/router-core:test:unit --outputStyle=stream --skipRemoteCache -- tests/load.test.tsCI=1 NX_DAEMON=false pnpm nx run @tanstack/router-core:test:types --outputStyle=stream --skipRemoteCache
Summary by CodeRabbit#
Bug Fixes
- Improved route loader cleanup so background preloads clean up reliably and tolerate missing or evicted matches without errors.
- Enhanced behavior during cache eviction/invalidation to avoid spurious errors when preloads are still in flight.
Tests
- Added concurrency tests covering cache eviction and invalidation interacting with in‑flight preloads.
Chores
- Added a changeset to publish a patch release.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: router-core
🤖 Nx Cloud AI Fix Eligible#
To disable these notifications, a workspace admin can disable them [in workspace settings.](https://cloud.nx.app/orgs/6412ca9d1c251d000efa21ba/workspaces/6442f7de8226a6291646a813/settings/self-healing-ci?utm_source=pull-request&utm_medium=comment)An automatically generated fix could have helped fix failing tasks for this run, but Self-healing CI is disabled for this workspace. Visit workspace settings to enable it and get automatic fixes in future runs.
View your CI Pipeline Execution ↗ for commit d86b13dc52ad789085817370ff83edc563bdd05f
Command Status Duration Result nx affected --targets=test:eslint,test:unit,tes...❌ Failed 10m 42s View ↗ nx run-many --target=build --exclude=examples/*...✅ Succeeded 1m 48s View ↗
☁️ Nx Cloud last updated this comment at
2026-03-21 17:36:55UTC🚀 Changeset Version Preview#
1 package(s) bumped directly, 21 bumped as dependents.
🟩 Patch bumps#
Package Version Reason @tanstack/router-core1.168.1 → 1.168.2 Changeset @tanstack/react-router1.168.1 → 1.168.2 Dependent @tanstack/react-start1.167.2 → 1.167.3 Dependent @tanstack/react-start-client1.166.16 → 1.166.17 Dependent @tanstack/react-start-server1.166.16 → 1.166.17 Dependent @tanstack/router-cli1.166.16 → 1.166.17 Dependent @tanstack/router-generator1.166.15 → 1.166.16 Dependent @tanstack/router-plugin1.167.2 → 1.167.3 Dependent @tanstack/router-vite-plugin1.166.17 → 1.166.18 Dependent @tanstack/solid-router1.168.1 → 1.168.2 Dependent @tanstack/solid-start1.167.2 → 1.167.3 Dependent @tanstack/solid-start-client1.166.15 → 1.166.16 Dependent @tanstack/solid-start-server1.166.15 → 1.166.16 Dependent @tanstack/start-client-core1.167.1 → 1.167.2 Dependent @tanstack/start-plugin-core1.167.5 → 1.167.6 Dependent @tanstack/start-server-core1.167.1 → 1.167.2 Dependent @tanstack/start-static-server-functions1.166.17 → 1.166.18 Dependent @tanstack/start-storage-context1.166.15 → 1.166.16 Dependent @tanstack/vue-router1.168.1 → 1.168.2 Dependent @tanstack/vue-start1.167.2 → 1.167.3 Dependent @tanstack/vue-start-client1.166.15 → 1.166.16 Dependent @tanstack/vue-start-server1.166.15 → 1.166.16 Dependent Bundle Size Benchmarks#
- Commit:
d7445e048d7d - Measured at:
2026-03-21T17:27:15.775Z - Baseline source:
history:0d11d5e494bb - Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Raw Brotli Trend react-router.minimal88.69 KiB +141 B (+0.16%) 279.67 KiB 76.92 KiB ▁▁▁▁▁▇▇▇▇▇▇█ react-router.full91.84 KiB +114 B (+0.12%) 290.40 KiB 79.64 KiB ▁▁▁▁▁▇▇▇▇▇▇█ solid-router.minimal36.30 KiB +175 B (+0.47%) 109.42 KiB 32.52 KiB █████▁▁▁▁▁▁▂ solid-router.full40.65 KiB +169 B (+0.41%) 122.55 KiB 36.37 KiB █████▁▁▁▁▁▁▂ vue-router.minimal54.28 KiB +177 B (+0.32%) 155.71 KiB 48.59 KiB ▁▁▁▁▁▇▇▇▇▇▇█ vue-router.full59.05 KiB +171 B (+0.28%) 170.86 KiB 52.77 KiB ▁▁▁▁▁▇▇▇▇▇▇█ react-start.minimal103.16 KiB +165 B (+0.16%) 327.74 KiB 89.08 KiB ▁▁▁▁▁▇▇▇▇▇▇█ react-start.full106.52 KiB +157 B (+0.14%) 338.05 KiB 91.93 KiB ▁▁▁▁▁▇▇▇▇▇▇█ solid-start.minimal50.45 KiB +137 B (+0.27%) 155.91 KiB 44.42 KiB █████▁▁▁▁▁▁▂ solid-start.full55.88 KiB +153 B (+0.27%) 171.74 KiB 49.12 KiB █████▁▁▁▁▁▁▂ Trend sparkline is historical gzip bytes ending with this PR measurement; lower is better.
- Commit:
🧹 Nitpick comments (1)
packages/router-core/tests/load.test.ts (1)
442-502: Good regression test for invalidate during in-flight preload.The test properly exercises the second scenario from the PR objectives, verifying that
router.invalidate()doesn't cause errors when a preload is still in-flight.Minor suggestion: Consider wrapping the spy cleanup in a
try/finallyor usingafterEachto ensuremockRestore()runs even if assertions fail. This prevents spy leakage affecting subsequent tests.+ test('does not error when invalidate clears an in-flight preload', async () => { + const consoleErrorSpy = vi + .spyOn(console, 'error') + .mockImplementation(() => {}) + + try { // ... test body ... + + expect(consoleErrorSpy).not.toHaveBeenCalled() + // ... remaining assertions ... + } finally { + consoleErrorSpy.mockRestore() + } + })🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/router-core/tests/load.test.ts` around lines 442 - 502, Wrap the console.error spy setup/cleanup in a safe teardown to guarantee restore even on test failures: move the vi.spyOn(...).mockImplementation to the start of the test and ensure mockRestore() is executed in a finally block (or register the spy with an afterEach cleanup) so consoleErrorSpy.mockRestore() always runs; reference the existing consoleErrorSpy variable and its mockRestore call in the "does not error when invalidate clears an in-flight preload" test in packages/router-core/tests/load.test.ts.🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed. Nitpick comments: In `@packages/router-core/tests/load.test.ts`: - Around line 442-502: Wrap the console.error spy setup/cleanup in a safe teardown to guarantee restore even on test failures: move the vi.spyOn(...).mockImplementation to the start of the test and ensure mockRestore() is executed in a finally block (or register the spy with an afterEach cleanup) so consoleErrorSpy.mockRestore() always runs; reference the existing consoleErrorSpy variable and its mockRestore call in the "does not error when invalidate clears an in-flight preload" test in packages/router-core/tests/load.test.ts.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID:
f2b1be56-69c4-4523-a55d-6a979300cb85📥 Commits
Reviewing files that changed from the base of the PR and between 0d11d5e494bbf2a52110bf950bb3d694e1b77285 and ce450adb9a402d0a53f4d328f58c77c07d61e72d.
📒 Files selected for processing (2)
packages/router-core/src/load-matches.tspackages/router-core/tests/load.test.ts
More templates
- tanstack-router-react-example-authenticated-routes
- tanstack-router-react-example-authenticated-routes-firebase
- tanstack-router-react-example-basic
- tanstack-router-react-example-basic-default-search-params
- tanstack-router-react-example-basic-devtools-panel
- tanstack-router-react-example-basic-file-based
- tanstack-router-react-example-basic-non-nested-devtools
- tanstack-router-react-example-react-query
- tanstack-router-react-example-basic-react-query-file-based
- tanstack-router-react-example-basic-ssr-file-based
- tanstack-router-react-example-basic-ssr-streaming-file-based
- tanstack-router-react-example-basic-virtual-file-based
- tanstack-router-react-example-basic-virtual-inside-file-based
- tanstack-router-react-example-deferred-data
- tanstack-router-i18n-paraglide
- tanstack-router-react-example-kitchen-sink
- tanstack-router-react-example-kitchen-sink-file-based
- tanstack-router-react-example-kitchen-sink-react-query
- tanstack-router-react-example-kitchen-sink-react-query-file-based
- tanstack-router-react-example-large-file-based
- tanstack-router-react-example-location-masking
- tanstack-router-react-example-navigation-blocking
- tanstack-router-react-example-quickstart
- tanstack-router-react-example-quickstart-esbuild-file-based
- tanstack-router-react-example-quickstart-file-based
- tanstack-router-react-example-quickstart-rspack-file-based
- tanstack-router-react-example-quickstart-webpack-file-based
- router-monorepo-react-query
- router-mono-simple
- router-mono-simple-lazy
- tanstack-router-react-example-scroll-restoration
- tanstack-search-validator-adapters
- tanstack-start-example-bare
- tanstack-start-example-basic
- tanstack-start-example-basic-auth
- tanstack-router-react-example-basic-authjs
- tanstack-start-example-basic-cloudflare
- tanstack-start-example-basic-react-query
- tanstack-start-example-basic-rsc
- tanstack-start-example-basic-static
- tanstack-start-bun-hosting
- tanstack-start-example-clerk-basic
- tanstack-start-example-convex-trellaux
- tanstack-start-example-counter
- tanstack-start-i18n-paraglide
- tanstack-start-example-large
- tanstack-start-example-material-ui
- tanstack-start-streaming-data-from-server-functions
- tanstack-start-example-supabase-basic
- tanstack-start-tailwind-v4
- tanstack-start-example-trellaux
- tanstack-start-example-workos
- tanstack-router-react-example-view-transitions
- tanstack-router-react-example-with-framer-motion
- tanstack-router-react-example-with-trpc
- tanstack-router-react-example-with-trpc-react-query
- tanstack-router-vue-example-basic-jsx
- tanstack-router-vue-example-basic-file-based-jsx
- tanstack-router-vue-example-basic-file-based-sfc
- 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@7003@tanstack/eslint-plugin-router
npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@7003@tanstack/history
npm i https://pkg.pr.new/@tanstack/history@7003@tanstack/nitro-v2-vite-plugin
npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@7003@tanstack/react-router
npm i https://pkg.pr.new/@tanstack/react-router@7003@tanstack/react-router-devtools
npm i https://pkg.pr.new/@tanstack/react-router-devtools@7003@tanstack/react-router-ssr-query
npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@7003@tanstack/react-start
npm i https://pkg.pr.new/@tanstack/react-start@7003@tanstack/react-start-client
npm i https://pkg.pr.new/@tanstack/react-start-client@7003@tanstack/react-start-server
npm i https://pkg.pr.new/@tanstack/react-start-server@7003@tanstack/router-cli
npm i https://pkg.pr.new/@tanstack/router-cli@7003@tanstack/router-core
npm i https://pkg.pr.new/@tanstack/router-core@7003@tanstack/router-devtools
npm i https://pkg.pr.new/@tanstack/router-devtools@7003@tanstack/router-devtools-core
npm i https://pkg.pr.new/@tanstack/router-devtools-core@7003@tanstack/router-generator
npm i https://pkg.pr.new/@tanstack/router-generator@7003@tanstack/router-plugin
npm i https://pkg.pr.new/@tanstack/router-plugin@7003@tanstack/router-ssr-query-core
npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@7003@tanstack/router-utils
npm i https://pkg.pr.new/@tanstack/router-utils@7003@tanstack/router-vite-plugin
npm i https://pkg.pr.new/@tanstack/router-vite-plugin@7003@tanstack/solid-router
npm i https://pkg.pr.new/@tanstack/solid-router@7003@tanstack/solid-router-devtools
npm i https://pkg.pr.new/@tanstack/solid-router-devtools@7003@tanstack/solid-router-ssr-query
npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@7003@tanstack/solid-start
npm i https://pkg.pr.new/@tanstack/solid-start@7003@tanstack/solid-start-client
npm i https://pkg.pr.new/@tanstack/solid-start-client@7003@tanstack/solid-start-server
npm i https://pkg.pr.new/@tanstack/solid-start-server@7003@tanstack/start-client-core
npm i https://pkg.pr.new/@tanstack/start-client-core@7003@tanstack/start-fn-stubs
npm i https://pkg.pr.new/@tanstack/start-fn-stubs@7003@tanstack/start-plugin-core
npm i https://pkg.pr.new/@tanstack/start-plugin-core@7003@tanstack/start-server-core
npm i https://pkg.pr.new/@tanstack/start-server-core@7003@tanstack/start-static-server-functions
npm i https://pkg.pr.new/@tanstack/start-static-server-functions@7003@tanstack/start-storage-context
npm i https://pkg.pr.new/@tanstack/start-storage-context@7003@tanstack/valibot-adapter
npm i https://pkg.pr.new/@tanstack/valibot-adapter@7003@tanstack/virtual-file-routes
npm i https://pkg.pr.new/@tanstack/virtual-file-routes@7003@tanstack/vue-router
npm i https://pkg.pr.new/@tanstack/vue-router@7003@tanstack/vue-router-devtools
npm i https://pkg.pr.new/@tanstack/vue-router-devtools@7003@tanstack/vue-router-ssr-query
npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@7003@tanstack/vue-start
npm i https://pkg.pr.new/@tanstack/vue-start@7003@tanstack/vue-start-client
npm i https://pkg.pr.new/@tanstack/vue-start-client@7003@tanstack/vue-start-server
npm i https://pkg.pr.new/@tanstack/vue-start-server@7003@tanstack/zod-adapter
npm i https://pkg.pr.new/@tanstack/zod-adapter@7003commit:
d86b13d💡 Codex Review#
Here are some automated review suggestions for this pull request.
Reviewed commit:
ce450adb9aℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
@@ -936,4 +950,6 @@936950 await handleLoader(preload, prevMatch, previousRouteMatchId, match, route)937951 }938952 }939- const match = inner.router.getMatch(matchId)!953+ const match = inner.router.getMatch(matchId)954+ if (!match) {955+ return inner.matches[index]!Don't mark a canceled navigation as fully loaded
If a loader ignores
abortControllerand the user navigates away before it settles,beforeLoad()for the newer navigation replaces the old pending match (router.ts:2362-2369). Hitting this fallback turns the canceledloadRouteMatch()into a success, soloadMatches()still reachestriggerOnReady(), and theonReadycallback inrouter.ts:2409-2490commits whatever newerpendingMatchesSnapshotexists at that moment. That can mount the second navigation before its own loaders have finished.Useful? React with 👍 / 👎.
@@ -936,4 +950,6 @@936950 await handleLoader(preload, prevMatch, previousRouteMatchId, match, route)937951 }938952 }939- const match = inner.router.getMatch(matchId)!953+ const match = inner.router.getMatch(matchId)954+ if (!match) {955+ return inner.matches[index]!Don't return stale pending matches from evicted preloads
For preloads,
preloadRoute()'s customupdateMatchwrites loader results into the router store rather than mutatinginner.matches(router.ts:2843-2849). If cache GC orinvalidate()evicts the match before the loader finishes, this fallback returns the originalinner.matches[index]!, whosestatusandloaderDataare still stale (pendingwith no data). Any caller that awaitsrouter.preloadRoute()and consumes the returned matches will get an incorrect result instead of a missing/failed preload.Useful? React with 👍 / 👎.
Merging this PR will not alter performance#
✅ 6untouched benchmarks
Comparingopencode/shiny-orchid(d86b13d) withmain(d7445e0)Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed. Inline comments: In `@packages/router-core/src/load-matches.ts`: - Around line 946-961: The eviction cleanup must run even when loadRouteMatch takes the loaderShouldRunAsync/loaderIsRunningAsync early-return path; attach a background cleanup that executes after the detached loader finishes and checks inner.router.getMatch(matchId) and then performs the same steps currently inside the if-block (resolve preloadCleanupMatch._nonReactive.loaderPromise and .loadPromise, clear pendingTimeout, unset loaderPromise/loadPromise/dehydrated). Concretely, in the loaderShouldRunAsync branch of loadRouteMatch, before returning, register a finally/then handler on prevMatch._nonReactive.loaderPromise (or create a small async detached task) that re-checks inner.router.getMatch(matchId) and, if missing, runs the existing cleanup logic for preloadCleanupMatch (resolving promises and clearing nonReactive fields) so a subsequent preload won't hang waiting on an orphaned loaderPromise.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID:
b2242935-144c-4829-bd58-15bb69b780c0📥 Commits
Reviewing files that changed from the base of the PR and between 911a46e1d83e6d942357516a64748ab5804c3902 and 3e988de0530cb184b05e7b3ddd38a44e3296b722.
📒 Files selected for processing (1)
packages/router-core/src/load-matches.ts
@@ -936,4 +943,19 @@936943 await handleLoader(preload, prevMatch, previousRouteMatchId, match, route)937944 }938945 }939- const match = inner.router.getMatch(matchId)!946+ const currentMatch = inner.router.getMatch(matchId)947+ if (!currentMatch && inner.preload && preloadCleanupMatch) {948+ if (!loaderIsRunningAsync) {949+ preloadCleanupMatch._nonReactive.loaderPromise?.resolve()950+ preloadCleanupMatch._nonReactive.loadPromise?.resolve()951+ preloadCleanupMatch._nonReactive.loadPromise = undefined952+ }953+954+ clearTimeout(preloadCleanupMatch._nonReactive.pendingTimeout)955+ preloadCleanupMatch._nonReactive.pendingTimeout = undefined956+ if (!loaderIsRunningAsync) {957+ preloadCleanupMatch._nonReactive.loaderPromise = undefined958+ }959+ preloadCleanupMatch._nonReactive.dehydrated = undefined960+961+ return preloadCleanupMatch⚠️ Potential issue | 🟠 Major
Cleanup still misses evictions after the background reload has already detached.
This branch only runs while the current
loadRouteMatch()call is still executing. In theloaderShouldRunAsyncpath, the function returns first, so an eviction that happens afterwards never reaches this cleanup. If another preload starts in that window, it will block on the existingprevMatch._nonReactive.loaderPromise, and the detached task still resolves that promise only viainner.router.getMatch(matchId). Once the store entry is gone, that promise is orphaned and the second preload can hang indefinitely.🔧 Suggested direction
} else if ( loaderShouldRunAsync && !inner.sync && shouldReloadInBackground ) { loaderIsRunningAsync = true + const matchForCleanup = prevMatch ;(async () => { try { await runLoader(inner, matchPromises, matchId, index, route) - const match = inner.router.getMatch(matchId)! - match._nonReactive.loaderPromise?.resolve() - match._nonReactive.loadPromise?.resolve() - match._nonReactive.loaderPromise = undefined - match._nonReactive.loadPromise = undefined } catch (err) { if (isRedirect(err)) { await inner.router.navigate(err.options) } + } finally { + const match = inner.router.getMatch(matchId) ?? matchForCleanup + match._nonReactive.loaderPromise?.resolve() + match._nonReactive.loadPromise?.resolve() + match._nonReactive.loaderPromise = undefined + match._nonReactive.loadPromise = undefined } })()🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/router-core/src/load-matches.ts` around lines 946 - 961, The eviction cleanup must run even when loadRouteMatch takes the loaderShouldRunAsync/loaderIsRunningAsync early-return path; attach a background cleanup that executes after the detached loader finishes and checks inner.router.getMatch(matchId) and then performs the same steps currently inside the if-block (resolve preloadCleanupMatch._nonReactive.loaderPromise and .loadPromise, clear pendingTimeout, unset loaderPromise/loadPromise/dehydrated). Concretely, in the loaderShouldRunAsync branch of loadRouteMatch, before returning, register a finally/then handler on prevMatch._nonReactive.loaderPromise (or create a small async detached task) that re-checks inner.router.getMatch(matchId) and, if missing, runs the existing cleanup logic for preloadCleanupMatch (resolving promises and clearing nonReactive fields) so a subsequent preload won't hang waiting on an orphaned loaderPromise.Sheraff(GitHub profile, opens in a new tab) closed this
Thanks @Sheraff ! When will it be in a release?
Thanks @Sheraff ! When will it be in a release?
very soon, a couple hours maybe
Thanks @Sheraff ! When will it be in a release?
very soon, a couple hours maybe
Alright perfect. Thanks :)
Sign in to join this conversation.
Important
Review skipped#
Draft detected.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID:
8214f406-4ff8-4b0b-b75d-83a8a5b9c469You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
📝 Walkthrough
Walkthrough#
Capture the match used for stale-while-revalidate preloads, handle cases where the match is removed during in-flight preload by cleaning up loader promises and related state, and add tests and a changeset ensuring cache eviction during preload does not error.
Changes#
packages/router-core/src/load-matches.tsinner.preloadis true; derive finalmatchfrominner.router.getMatch(matchId)(nullable) and, if the match was removed during preload, resolve/clear controlled preloadloaderPromise/loadPromise, clearpendingTimeout, reset_nonReactive.loaderPromisewhen appropriate, clear_nonReactive.dehydrated, and return the captured match to avoid accessing removed state.packages/router-core/tests/load.test.tsclearExpiredCache()orinvalidate()run while apreloadRouteloader is unresolved: ensure cached match is removed, sibling loaders behave correctly, and completion of the in-flight preload does not trigger console errors..changeset/moody-kings-travel.mdEstimated code review effort#
🎯 3 (Moderate) | ⏱️ ~22 minutes
Poem#
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)#
✅ Passed checks (2 passed)
✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands and usage tips.