Skip to content

fix(start): import Register from framework package so module augmentation works#7357

Open
Zelys-DFKH wants to merge 2 commits intoTanStack:mainfrom
Zelys-DFKH:fix-server-entry-register-import
Open

fix(start): import Register from framework package so module augmentation works#7357
Zelys-DFKH wants to merge 2 commits intoTanStack:mainfrom
Zelys-DFKH:fix-server-entry-register-import

Conversation

@Zelys-DFKH
Copy link
Copy Markdown
Contributor

@Zelys-DFKH Zelys-DFKH commented May 7, 2026

Fixes #7353.

createServerEntry in all three framework adapters imported Register from the router package (@tanstack/react-router, @tanstack/solid-router, @tanstack/vue-router), while the docs tell users to augment their start package:

declare module '@tanstack/react-start' {
  interface Register {
    server: { requestContext: { userId: string } }
  }
}

TypeScript module augmentation is module-scoped, so augmenting @tanstack/react-start had no effect on a Register imported from @tanstack/react-router. The typed context parameter just silently didn't show up — no error, just no types, which makes it genuinely hard to debug.

The fix follows the same pattern as the existing router registration (you augment @tanstack/react-router and import from it). All three packages already re-export Register through @tanstack/start-client-core, and the server-entry files already self-import from their own packages (e.g. from '@tanstack/react-start/server'). Changing the Register import to match the module users are told to augment is all it takes.

Changes

  • packages/react-start/src/default-entry/server.ts: from '@tanstack/react-router'from '@tanstack/react-start'
  • packages/solid-start/src/default-entry/server.ts: from '@tanstack/solid-router'from '@tanstack/solid-start'
  • packages/vue-start/src/default-entry/server.ts: from '@tanstack/vue-router'from '@tanstack/vue-start'

No runtime behavior changes.

How to verify

Add this augmentation in your project:

declare module '@tanstack/react-start' {
  interface Register {
    server: { requestContext: { userId: string } }
  }
}

Before: context on createServerEntry({ fetch }) is optional and typed as BaseContext regardless of the augmentation. After: context is required and typed as { userId: string } & { nonce?: string }.

Summary by CodeRabbit

Release Notes

  • Refactor
    • Updated type imports in React Start, Solid Start, and Vue Start framework integration packages to improve internal consistency and organization.

All three framework adapters (react-start, solid-start, vue-start) imported
Register from their router package, but the docs tell users to augment their
start package. TypeScript module augmentation is module-scoped, so the
registered context type was silently ignored.

Closes TanStack#7353.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6cdb8933-ce64-49ba-bf97-1be87f09b725

📥 Commits

Reviewing files that changed from the base of the PR and between 1523612 and 970370b.

📒 Files selected for processing (3)
  • packages/react-start/src/default-entry/server.ts
  • packages/solid-start/src/default-entry/server.ts
  • packages/vue-start/src/default-entry/server.ts

📝 Walkthrough

Walkthrough

Three framework starter entry points update their Register type imports. React Start now imports Register from @tanstack/react-start instead of @tanstack/react-router. Solid Start and Vue Start apply the same pattern, importing from their respective @tanstack/*-start packages instead of router packages.

Changes

Framework Starter Type Import Consolidation

Layer / File(s) Summary
Import Source Update
packages/react-start/src/default-entry/server.ts, packages/solid-start/src/default-entry/server.ts, packages/vue-start/src/default-entry/server.ts
Register type imported from framework-start package instead of framework-router package. ServerEntry type continues to use RequestHandler<Register> unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A hop and a skip, the imports align, ✨
From routers to starters, the types now shine,
React, Solid, Vue—three friends made whole,
All dancing from one shared soul! 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: fixing imports of the Register type from framework packages to enable proper TypeScript module augmentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented May 7, 2026

View your CI Pipeline Execution ↗ for commit 1674edd

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

☁️ Nx Cloud last updated this comment at 2026-05-07 01:18:15 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Bundle Size Benchmarks

  • Commit: 15236122707e
  • Measured at: 2026-05-07T01:07:49.270Z
  • Baseline source: history:35e88f04996d
  • Dashboard: bundle-size history
Scenario Current (gzip) Delta vs baseline Initial gzip Raw Brotli Trend
react-router.minimal 87.29 KiB +139 B (+0.16%) 87.15 KiB 274.07 KiB 75.81 KiB ▁▁▁▁▁▁▁▁▁▁▁█
react-router.full 90.82 KiB +141 B (+0.15%) 90.68 KiB 285.58 KiB 78.82 KiB ▁▁▁▁▁▁▁▁▁▁▁█
solid-router.minimal 35.51 KiB +126 B (+0.35%) 35.38 KiB 106.36 KiB 31.91 KiB ▁▁▁▁▁▁▁▁▁▁▁█
solid-router.full 40.23 KiB +127 B (+0.31%) 40.10 KiB 120.58 KiB 36.14 KiB ▁▁▁▁▁▁▁▁▁▁▁█
vue-router.minimal 53.28 KiB +131 B (+0.24%) 53.15 KiB 151.51 KiB 47.83 KiB ▁▁▁▁▁▁▁▁▁▁▁█
vue-router.full 58.41 KiB +133 B (+0.22%) 58.28 KiB 167.68 KiB 52.30 KiB ▁▁▁▁▁▁▁▁▁▁▁█
react-start.minimal 101.97 KiB +141 B (+0.14%) 101.84 KiB 322.51 KiB 88.13 KiB ▁▁▁▁▁▁▁▁▁▁▃█
react-start.full 105.41 KiB +140 B (+0.13%) 105.27 KiB 332.84 KiB 91.10 KiB ▁▁▁▁▁▁▁▁▁▁▄█
react-start.rsbuild.minimal 99.60 KiB +174 B (+0.17%) 99.43 KiB 316.97 KiB 85.65 KiB ▁▁▁▁▁▁▁▁▁▁▄█
react-start.rsbuild.full 102.89 KiB +174 B (+0.17%) 102.72 KiB 327.41 KiB 88.45 KiB ▁▁▁▁▁▁▁▁▁▁▃█
solid-start.minimal 49.61 KiB +131 B (+0.26%) 49.48 KiB 152.48 KiB 43.79 KiB ▁▁▁▁▁▁▁▁▁▁▄█
solid-start.full 55.40 KiB +133 B (+0.24%) 55.27 KiB 169.39 KiB 48.70 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
Copy link
Copy Markdown

pkg-pr-new Bot commented May 7, 2026

More templates

@tanstack/arktype-adapter

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

@tanstack/eslint-plugin-router

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

@tanstack/eslint-plugin-start

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

@tanstack/history

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

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

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

@tanstack/react-start-client

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

@tanstack/react-start-rsc

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

@tanstack/react-start-server

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

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

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

@tanstack/solid-start-client

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

@tanstack/solid-start-server

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

@tanstack/start-client-core

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

@tanstack/start-fn-stubs

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

@tanstack/start-plugin-core

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

@tanstack/start-server-core

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

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

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

@tanstack/valibot-adapter

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

@tanstack/virtual-file-routes

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

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

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

@tanstack/vue-start-client

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

@tanstack/vue-start-server

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

@tanstack/zod-adapter

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

commit: 1674edd

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 7, 2026

Merging this PR will not alter performance

✅ 5 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing Zelys-DFKH:fix-server-entry-register-import (1674edd) with main (a04d5e4)2

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

  2. No successful run was found on main (1523612) during the generation of this report, so a04d5e4 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copy link
Copy Markdown
Contributor

@nx-cloud nx-cloud Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nx Cloud has identified a flaky task in your failed CI:

Since the failure was identified as flaky, the solution is to rerun CI. Because this branch comes from a fork, it is not possible for us to push directly, but you can rerun by pushing an empty commit:

git commit --allow-empty -m "chore: trigger rerun"
git push

Nx Cloud View detailed reasoning in Nx Cloud ↗


🎓 Learn more about Self-Healing CI on nx.dev

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.

TanStack Start server-entry requestContext type ignores @tanstack/react-start Register augmentation

1 participant