Match loading invalidation - #7939
Conversation
…match-loader # Conflicts: # packages/router-core/tests/issue-4684-head-on-beforeload-error.test.ts
…match-loader # Conflicts: # packages/router-core/tests/issue-5106-hydrated-notfound-boundary.test.ts
…match-loader # Conflicts: # e2e/react-start/selective-ssr/src/routeTree.gen.ts # e2e/solid-start/selective-ssr/src/routeTree.gen.ts
* fix(router-core): harden lane loading lifecycle * ci: apply automated fixes * fix(router-core): optimize lane loading followups * fix(router-core): simplify redirect limit handling * refactor(router-core): clarify loader state and caches --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* perf(router): reduce SSR lane loading overhead * ci: apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* fix(router): address lane loader regressions * perf(router-core): shave asset-prefix bookkeeping bytes - rename the internal `_dataOnlyAssetEnd` match field to `_assetEnd`: property keys survive minification, so the shorter internal name saves bytes at every site in every bundle - reduce the `_getAssetMatches` guard to a presence check: the field is only ever set on hydration presentation clones that already satisfy the pending/data-only/error-free/not-not-found conditions, and commits clear it (invariant documented at the guard) - clone-then-patch the hydration handoff splice instead of spreading a conditional object per element, and drop the unreachable zero guard in `_getAssetMatches` Measured (gzip, vs PR tip): react-router.full -43 B, vue-router.full -35 B, react-router.minimal -8 B. All unit suites green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(router-devtools): preload lazy panel --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…7883) * fix(router): final-review regressions, changeset, and byte recovery Fixes the regressions vs main found in the final review of #7805: - restore history-subscription cleanup on router provider unmount in all three adapters (react returns the unsubscribe unconditionally, solid uses onCleanup, vue uses onUnmounted), pinned by new transitioner-remount tests — a discarded router could previously keep loading on back/forward as a zombie - same-destination navigations now join the in-flight transaction instead of aborting and restarting it (double-click no longer reruns loaders); reloads and same-location redirects keep restart semantics - commitMatches cache retention can no longer resurrect a one-generation-old loaderData when a newer committed success exists for the same match id - same-location dedup keeps __tempLocation/__tempKey so masked vs real same-href navigations commit their state again Adds the missing release changeset enumerating the removed/changed public API with migration hints. Byte recovery: merges rendered-matches.ts, route-chunks.ts and hydrate.ts into load-client.ts so the client bundle shares gzip dictionary context across what were separate module boundaries (-104..-186 gzip B per start scenario; plain router scenarios remain net-negative vs main and hydration still tree-shakes out of them). The solid/vue store-update-count pins were re-adjusted after verifying the published update sequences are byte-identical: the counts only shifted because a one-microtask timing change moves the tests' waitFor-sampled window boundary (5 of 7 counts decreased). * test(router-devtools-core): keep panel chunk warm-up out of the test budget The cache-replacement test warmed Vite's lazy transform of BaseTanStackRouterDevtoolsPanel inside the test body, so on slow CI runners the transform alone could blow the 5s test timeout (observed at 5.89s). Move the warm-up to a beforeAll with its own generous timeout and give the test itself explicit headroom. Pre-existing flake on the lane branch tip, surfaced by this PR's CI being the first to run on it. * refactor(router-core): extend lane typestate to matches and commits The lane pipeline already carried phase brands at lane granularity (Lane<'matched'|'contextualized'|'reduced'|'projected'>); this finishes the pattern at the two granularities it was missing, at zero runtime cost (all emitted dist JS verified byte-identical): - settleInto becomes the sole granter of a SettledMatch brand via an assertion signature, and cacheLoaderMatch requires it — the loader -> settle -> cache ordering is now compiler-enforced. The one legitimate phase jump (hydration cache-seeding of already-settled dehydrated data) is a single named, commented boundary cast. - commitMatches/commitRefreshMatches only accept a projected lane's matches (LaneMatches<'projected'>), so committing an earlier-phase lane no longer compiles. - LoadTransaction's dev-only refresh triple collapses into one optional slot [presentation, handoff?], making a half-armed refresh state unrepresentable and shrinking the clear/read sites.
…match-loader # Conflicts: # e2e/react-start/selective-ssr/src/routeTree.gen.ts # e2e/react-start/selective-ssr/src/routes/__root.tsx # e2e/react-start/selective-ssr/tests/app.spec.ts # packages/react-router/tests/component-preload-retry-pending-min.test.tsx # packages/react-router/tests/not-found.test.tsx # packages/react-router/tests/public-presentation-lane-contract.test.tsx # packages/react-router/tests/redirect.test.tsx # packages/react-router/tests/transactional-loading.test.tsx # packages/react-router/tests/transitioner-remount.test.tsx # packages/react-start-client/src/tests/hydrateStart.test.ts # packages/router-core/tests/background-trim-abort.test.ts # packages/router-core/tests/boundary-component-chunk.test.ts # packages/router-core/tests/callbacks.test.ts # packages/router-core/tests/client-lane-adversarial.test.ts # packages/router-core/tests/error-boundary-cache-generation.test.ts # packages/router-core/tests/granular-stores.test.ts # packages/router-core/tests/hydrate.test.ts # packages/router-core/tests/issue-6221-head-waits-for-loader.test.ts # packages/router-core/tests/loader-architecture-regressions.test.ts # packages/router-core/tests/loader-self-abort.test.ts # packages/router-core/tests/masked-location-state-commit.test.ts # packages/router-core/tests/parent-match-promise.test.ts # packages/router-core/tests/preload-adoption.test.ts # packages/router-core/tests/preload-beforeload-reuse.test.ts # packages/router-core/tests/preload-navigation-adoption.test.ts # packages/router-core/tests/preload-public-cache-behavior.test.ts # packages/router-core/tests/public-client-loading-contract.test.ts # packages/router-core/tests/public-preload-lane-contract.test.ts # packages/router-core/tests/same-destination-navigation-join.test.ts # packages/router-core/tests/server-beforeload-preload-flag.test.ts # packages/router-core/tests/server-loader-abort-error.test.ts # packages/router-plugin/tests/handle-route-update.test.ts # packages/solid-router/tests/component-preload-retry.test.tsx # packages/solid-router/tests/createLazyRoute.test.tsx # packages/solid-router/tests/loaders.test.tsx # packages/solid-start-client/src/tests/hydrateStart.test.ts # packages/vue-router/tests/Transitioner.test.tsx # packages/vue-router/tests/disableGlobalCatchBoundary.test.tsx # packages/vue-router/tests/transitioner-remount-rendered.test.tsx # packages/vue-router/tests/transitioner-remount.test.tsx # packages/vue-router/tests/useMatch.test.tsx
* Always execute beforeLoad for client lanes * Simplify hydration handoff validation * ci: apply automated fixes * doc update
Use scoped Vitest test cleanup
* Simplify loader flight and render acknowledgement ownership * Fix lazy pending component publication * ci: apply automated fixes * simplify preflight, preload, and refresh ownership * tuple member names as comments * mathematically equivalent bundle size win in load-client * hydration bundle size * fix tests --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
|
View your CI Pipeline Execution ↗ for commit 9ef2c5d
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview4 package(s) bumped directly, 19 bumped as dependents. 🟩 Patch bumps
|
Bundle Size Benchmarks
The following scenarios have bundle-size changes compared with the baseline:
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. |
Merging this PR will degrade performance by 34.6%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Memory | mem server server-fn-churn (vue) |
269.1 KB | 4,184.9 KB | -93.57% |
| ❌ | Memory | mem server error-paths redirect (solid) |
279.2 KB | 702 KB | -60.23% |
| ❌ | Memory | mem server error-paths redirect (react) |
189.9 KB | 204 KB | -6.92% |
| ❌ | Simulation | ssr server-fn during document ssr (react) |
62.4 ms | 66.6 ms | -6.29% |
| ❌ | Simulation | client-loaders navigation loop (react) |
49.2 ms | 51.1 ms | -3.83% |
| ⚡ | Memory | mem server error-paths redirect (vue) |
890.3 KB | 386.1 KB | ×2.3 |
| ⚡ | Simulation | client-rewrites navigation loop (solid) |
84.2 ms | 81.4 ms | +3.47% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing match-loading-invalidation (d2ca7fa) with fix-router-core-lane-match-loader (f21614f)
|
included in #7805 |
No description provided.