Skip to content

Match loading invalidation - #7939

Closed
schiller-manuel wants to merge 70 commits into
mainfrom
match-loading-invalidation
Closed

Match loading invalidation#7939
schiller-manuel wants to merge 70 commits into
mainfrom
match-loading-invalidation

Conversation

@schiller-manuel

Copy link
Copy Markdown
Collaborator

No description provided.

Sheraff and others added 19 commits July 20, 2026 19:39
…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
* 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>
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a2ee761d-30a6-445e-b0dc-86cb5b112fdb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 9ef2c5d

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ❌ Failed 10m 4s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 2m 17s View ↗

☁️ Nx Cloud last updated this comment at 2026-08-02 22:33:01 UTC

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

4 package(s) bumped directly, 19 bumped as dependents.

🟩 Patch bumps

Package Version Reason
@tanstack/react-router 1.170.18 → 1.170.19 Changeset
@tanstack/router-core 1.171.15 → 1.171.16 Changeset
@tanstack/solid-router 1.170.18 → 1.170.19 Changeset
@tanstack/vue-router 1.170.17 → 1.170.18 Changeset
@tanstack/react-start 1.168.34 → 1.168.35 Dependent
@tanstack/react-start-client 1.168.16 → 1.168.17 Dependent
@tanstack/react-start-rsc 0.1.33 → 0.1.34 Dependent
@tanstack/react-start-server 1.167.22 → 1.167.23 Dependent
@tanstack/router-cli 1.167.21 → 1.167.22 Dependent
@tanstack/router-generator 1.167.21 → 1.167.22 Dependent
@tanstack/router-plugin 1.168.23 → 1.168.24 Dependent
@tanstack/router-vite-plugin 1.167.23 → 1.167.24 Dependent
@tanstack/solid-start 1.168.33 → 1.168.34 Dependent
@tanstack/solid-start-client 1.168.16 → 1.168.17 Dependent
@tanstack/solid-start-server 1.167.22 → 1.167.23 Dependent
@tanstack/start-client-core 1.170.14 → 1.170.15 Dependent
@tanstack/start-plugin-core 1.171.25 → 1.171.26 Dependent
@tanstack/start-server-core 1.169.17 → 1.169.18 Dependent
@tanstack/start-static-server-functions 1.167.19 → 1.167.20 Dependent
@tanstack/start-storage-context 1.167.17 → 1.167.18 Dependent
@tanstack/vue-start 1.168.32 → 1.168.33 Dependent
@tanstack/vue-start-client 1.167.19 → 1.167.20 Dependent
@tanstack/vue-start-server 1.167.22 → 1.167.23 Dependent

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: 2c9b76686843
  • Measured at: 2026-08-02T22:24:10.928Z
  • Baseline source: history:821295080766
  • 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.minimal 87.21 KiB -144 B (-0.16%) 87.07 KiB 269.38 KiB 75.89 KiB ███████████▁
react-router.full 91.00 KiB -60 B (-0.06%) 90.87 KiB 281.38 KiB 79.17 KiB ███████████▁
solid-router.minimal 34.92 KiB -615 B (-1.69%) 34.80 KiB 100.24 KiB 31.49 KiB ███████████▁
solid-router.full 40.04 KiB -560 B (-1.35%) 39.91 KiB 115.46 KiB 36.01 KiB ███████████▁
vue-router.minimal 52.21 KiB -803 B (-1.48%) 52.09 KiB 143.39 KiB 47.04 KiB ███████████▁
vue-router.full 58.18 KiB -776 B (-1.29%) 58.05 KiB 162.17 KiB 52.26 KiB ███████████▁
react-start.minimal 102.09 KiB +106 B (+0.10%) 101.95 KiB 318.36 KiB 88.57 KiB ▁▁▁▁▁▁▁▁▁▁▁█
react-start.deferred-hydration 102.83 KiB +111 B (+0.11%) 101.97 KiB 319.74 KiB 89.31 KiB ▁▁▁▁▁▁▁▁▁▁▁█
react-start.full 105.48 KiB +124 B (+0.11%) 105.35 KiB 328.37 KiB 91.47 KiB ▁▁▁▁▁▁▁▁▁▁▁█
react-start.rsbuild.minimal 99.84 KiB +149 B (+0.15%) 99.67 KiB 312.79 KiB 86.13 KiB ▁▁▁▁▁▁▂▂▂▂▂█
react-start.rsbuild.minimal-iife 100.24 KiB +148 B (+0.14%) 100.07 KiB 313.73 KiB 86.40 KiB ▁▁▁▁▁▁▂▂▂▂▂█
react-start.rsbuild.full 103.17 KiB +273 B (+0.26%) 103.00 KiB 322.95 KiB 88.77 KiB ▁▁▁▁▁▁▁▁▁▁▁█
solid-start.minimal 49.77 KiB +168 B (+0.33%) 49.64 KiB 148.11 KiB 44.13 KiB ▁▁▁▁▁▁▁▁▁▁▁█
solid-start.deferred-hydration 53.03 KiB +168 B (+0.31%) 49.70 KiB 156.15 KiB 47.14 KiB ▁▁▁▁▁▁▁▁▁▁▁█
solid-start.full 55.05 KiB -375 B (-0.66%) 54.92 KiB 163.89 KiB 48.75 KiB ███████████▁
vue-start.minimal 70.54 KiB -502 B (-0.69%) 70.41 KiB 201.16 KiB 62.65 KiB ███████████▁
vue-start.full 74.51 KiB -533 B (-0.69%) 74.38 KiB 213.76 KiB 66.06 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.

@pkg-pr-new

pkg-pr-new Bot commented Aug 2, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@7939

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@7939

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@7939

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@7939

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@7939

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@7939

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@7939

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@7939

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@7939

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@7939

@tanstack/react-start-rsc

npm i https://pkg.pr.new/@tanstack/react-start-rsc@7939

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@7939

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@7939

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@7939

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@7939

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@7939

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@7939

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@7939

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@7939

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@7939

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@7939

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@7939

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@7939

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@7939

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@7939

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@7939

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@7939

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@7939

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@7939

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@7939

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@7939

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@7939

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@7939

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@7939

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@7939

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@7939

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@7939

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@7939

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@7939

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@7939

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@7939

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@7939

commit: d2ca7fa

@codspeed-hq

codspeed-hq Bot commented Aug 2, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 34.6%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 2 improved benchmarks
❌ 5 regressed benchmarks
✅ 173 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

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)

Open in CodSpeed

Base automatically changed from fix-router-core-lane-match-loader to main August 4, 2026 18:28
@Sheraff

Sheraff commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

included in #7805

@Sheraff Sheraff closed this Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants