Skip to content

fix(start): keep server-only routes out of RSC bundles - #7944

Merged
schiller-manuel merged 1 commit into
mainfrom
fix-7938
Aug 3, 2026
Merged

fix(start): keep server-only routes out of RSC bundles#7944
schiller-manuel merged 1 commit into
mainfrom
fix-7938

Conversation

@schiller-manuel

@schiller-manuel schiller-manuel commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Use the Start storage context for request cancellation and focused server entrypoints to keep unrelated route dependencies out of the RSC module graph. Add emitted-build regression coverage for the boundary.

fixes #7938

Summary by CodeRabbit

  • New Features

    • Added dedicated server entrypoints for shared constants and virtual modules.
    • Added an RSC build-boundary endpoint for validating server-only route behavior.
  • Bug Fixes

    • Improved request-cancellation handling during server component rendering.
    • Prevented server-only dependencies from leaking into React Server Component output.
  • Tests

    • Added end-to-end coverage for RSC build-boundary isolation and server-rendered output.

Use the Start storage context for request cancellation and focused server entrypoints to keep unrelated route dependencies out of the RSC module graph. Add emitted-build regression coverage for the boundary.

fixes #7938
@nx-cloud

nx-cloud Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 819175d

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 11m 6s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 2m 9s View ↗

☁️ Nx Cloud last updated this comment at 2026-08-03 21:53:57 UTC

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

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

🟩 Patch bumps

Package Version Reason
@tanstack/react-start-rsc 0.1.33 → 0.1.34 Changeset
@tanstack/solid-start-server 1.167.22 → 1.167.23 Changeset
@tanstack/start-plugin-core 1.171.25 → 1.171.26 Changeset
@tanstack/start-server-core 1.169.17 → 1.169.18 Changeset
@tanstack/vue-start-server 1.167.22 → 1.167.23 Changeset
@tanstack/react-start 1.168.34 → 1.168.35 Dependent
@tanstack/react-start-server 1.167.22 → 1.167.23 Dependent
@tanstack/solid-start 1.168.33 → 1.168.34 Dependent
@tanstack/vue-start 1.168.32 → 1.168.33 Dependent

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: db97db87-df0e-4dc2-9a75-effabe60c12f

📥 Commits

Reviewing files that changed from the base of the PR and between b5e540d and 819175d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (25)
  • .changeset/calm-barrels-focus.md
  • .changeset/tidy-ravens-rest.md
  • e2e/react-start/rsc/src/routeTree.gen.ts
  • e2e/react-start/rsc/src/routes/api.rsc-build-boundary.ts
  • e2e/react-start/rsc/src/utils/rscBuildBoundarySentinel.ts
  • e2e/react-start/rsc/tests/rsc-build-boundary.spec.ts
  • packages/react-start-rsc/eslint.config.js
  • packages/react-start-rsc/package.json
  • packages/react-start-rsc/src/createCompositeComponent.ts
  • packages/react-start-rsc/src/renderServerComponent.ts
  • packages/react-start-rsc/tests/createServerComponent.test-d.tsx
  • packages/solid-start-server/src/defaultRenderHandler.tsx
  • packages/solid-start-server/src/defaultStreamHandler.tsx
  • packages/start-plugin-core/src/post-build.ts
  • packages/start-plugin-core/src/rsbuild/virtual-modules.ts
  • packages/start-plugin-core/src/vite/serialization-adapters-plugin.ts
  • packages/start-plugin-core/src/vite/start-compiler-plugin/plugin.ts
  • packages/start-plugin-core/src/vite/start-manifest-plugin/plugin.ts
  • packages/start-plugin-core/tests/post-server-build.test.ts
  • packages/start-plugin-core/tests/rsbuild/post-build.test.ts
  • packages/start-plugin-core/tests/start-manifest-plugin.test.ts
  • packages/start-server-core/package.json
  • packages/start-server-core/vite.config.ts
  • packages/vue-start-server/src/defaultRenderHandler.tsx
  • packages/vue-start-server/src/defaultStreamHandler.tsx
💤 Files with no reviewable changes (1)
  • packages/react-start-rsc/package.json

📝 Walkthrough

Walkthrough

The change adds focused start-server-core subpaths, updates server consumers, moves RSC cancellation handling to Start context, and adds an end-to-end test that checks server-only dependencies stay out of RSC output.

Changes

Focused server entrypoints

Layer / File(s) Summary
Subpath exports and consumer imports
packages/start-server-core/..., packages/start-plugin-core/..., packages/solid-start-server/..., packages/vue-start-server/..., packages/start-plugin-core/tests/..., .changeset/calm-barrels-focus.md
@tanstack/start-server-core now exports constants and virtual-modules subpaths. Start plugins use these subpaths. Solid and Vue handlers use their router SSR server modules. Tests and changeset metadata match the import changes.
RSC request context and import boundary
packages/react-start-rsc/..., .changeset/tidy-ravens-rest.md
RSC stream cancellation now uses ctx.request.signal. The root @tanstack/start-server-core dependency and imports are removed. ESLint rules reject root-barrel imports.
RSC build-boundary route and validation
e2e/react-start/rsc/src/..., e2e/react-start/rsc/tests/rsc-build-boundary.spec.ts
The RSC example adds a server-only sentinel route and generated route wiring. The test verifies the sentinel appears in SSR files and not in RSC files.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PlaywrightTest
  participant RscBuildBoundaryRoute
  participant SSRBuild
  participant RSCBuild
  PlaywrightTest->>RscBuildBoundaryRoute: Request /api/rsc-build-boundary
  RscBuildBoundaryRoute-->>PlaywrightTest: Return build-boundary sentinel
  PlaywrightTest->>SSRBuild: Scan executable SSR files
  SSRBuild-->>PlaywrightTest: Require sentinel
  PlaywrightTest->>RSCBuild: Scan executable RSC files
  RSCBuild-->>PlaywrightTest: Reject sentinel
Loading

Possibly related PRs

  • TanStack/router#7938: Both changes remove root @tanstack/start-server-core imports from RSC rendering files.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the primary change: preventing server-only routes from entering RSC bundles.
Linked Issues check ✅ Passed The changes remove the RSC root-barrel dependency, use Start storage context, and add emitted-build coverage for server-only route exclusion.
Out of Scope Changes check ✅ Passed The import updates, subpath exports, changesets, and regression tests directly support focused server entrypoints and RSC bundle isolation.
✨ 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-7938

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.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

This pull request does not affect bundle size in any measured scenario.

@pkg-pr-new

pkg-pr-new Bot commented Aug 3, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: 819175d

@codspeed-hq

codspeed-hq Bot commented Aug 3, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 21.68%

⚠️ 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

⚡ 8 improved benchmarks
❌ 5 regressed benchmarks
✅ 167 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory mem server error-paths unmatched (vue) 468.9 KB 2,207.6 KB -78.76%
Memory mem server error-paths unmatched (react) 369.2 KB 1,450.6 KB -74.55%
Memory mem server error-paths not-found (solid) 416.3 KB 983.7 KB -57.68%
Memory mem server server-fn-churn (vue) 269.4 KB 416.2 KB -35.28%
Memory mem server server-fn-churn (solid) 263.5 KB 273.6 KB -3.69%
Memory mem server error-paths redirect (vue) 809.1 KB 450.2 KB +79.74%
Memory mem server error-paths redirect (solid) 504.4 KB 442.7 KB +13.93%
Memory mem client preload-churn (vue) 758.9 KB 667.8 KB +13.63%
Simulation ssr server-fn multipart (solid) 63 ms 59.3 ms +6.18%
Memory mem server error-paths not-found (react) 280.9 KB 266.5 KB +5.4%
Simulation ssr server-fn raw-stream (solid) 111.8 ms 106.7 ms +4.77%
Simulation client-async-pipeline navigation loop (react) 51.7 ms 49.9 ms +3.73%
Simulation ssr server-fn raw-response (solid) 57.2 ms 55.3 ms +3.4%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing fix-7938 (819175d) with main (b5e540d)

Open in CodSpeed

@schiller-manuel
schiller-manuel merged commit 65f7b7f into main Aug 3, 2026
25 of 26 checks passed
@schiller-manuel
schiller-manuel deleted the fix-7938 branch August 3, 2026 22:02
This was referenced Aug 3, 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.

1 participant