Skip to content

fix(router-core): keep server loads pending until settled - #8740

Draft
BleedingDev wants to merge 17 commits into
TanStack:mainfrom
BleedingDev:fix/server-load-state-20261017
Draft

BleedingDev wants to merge 17 commits into
TanStack:mainfrom
BleedingDev:fix/server-load-state-20261017

Conversation

@BleedingDev

@BleedingDev BleedingDev commented Oct 17, 2026 •

Copy link
Copy Markdown

🎯 Changes

Why the change

Keep server routers pending until every active load finishes so callers cannot capture previous matches as a settled result.

Special things to note

  • Handles overlapping loads, synchronous reentry, redirects and thrown lifecycle callbacks without adding server reactivity.
  • Node 24.8 canonical checks pass for router-core and React, Solid and Vue bindings, including TypeScript 5.6–7.0 and strict package exports.
  • Authored with AI assistance and reviewed by Opus 5.5; full bundle results add 4–14 gzip bytes per scenario, all 34 React Start SSR cases pass, and hosted fork qualification remains pending.

Change outline

 serverLoad
+  activeServerLoads += 1
+  status = pending
   try
     resolve and commit matches
     run route lifecycle
   finally
-    status = idle
+    activeServerLoads -= 1
+    if activeServerLoads == 0
+      status = idle

The full core suite passes 3,663 tests across 139 files, with four expected failures and three existing skips. All three binding suites pass. Five identical baseline/candidate benchmarks check sequential loads, both overlap orders, lifecycle exceptions and request cancellation. The exception case adds about 0.2 microseconds per load; ordinary sequential loads are unchanged within measurement noise. All 18 bundle scenarios were measured without filtering. The full 34-case SSR comparison passes. A baseline/candidate/candidate/baseline repeat measured the common SSR request loop at 2.138/2.157 ms on average (+0.9%); server-function GET controls were +4.3% and POST +0.7%. Those controls bypass server route loading; the GET difference remains a disclosed measurement caveat rather than a claimed neutral result.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with the relevant test commands, or tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

@coderabbitai

coderabbitai Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@changeset-bot

changeset-bot Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 204bd33

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 23 packages
Name Type
@tanstack/router-core Minor
@tanstack/react-router Patch
@tanstack/react-start-client Patch
@tanstack/react-start-rsc Patch
@tanstack/react-start-server Patch
@tanstack/router-generator Patch
@tanstack/router-plugin Patch
@tanstack/solid-router Patch
@tanstack/solid-start-client Patch
@tanstack/solid-start-server Patch
@tanstack/start-client-core Patch
@tanstack/start-plugin-core Patch
@tanstack/start-server-core Patch
@tanstack/start-storage-context Patch
@tanstack/vue-router Patch
@tanstack/vue-start-client Patch
@tanstack/vue-start-server Patch
@tanstack/react-start Patch
@tanstack/router-cli Patch
@tanstack/router-vite-plugin Patch
@tanstack/solid-start Patch
@tanstack/start-static-server-functions Patch
@tanstack/vue-start Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant