fix(start): import Register from framework package so module augmentation works#7357
fix(start): import Register from framework package so module augmentation works#7357Zelys-DFKH wants to merge 2 commits intoTanStack:mainfrom
Conversation
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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThree framework starter entry points update their ChangesFramework Starter Type Import Consolidation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 1674edd
☁️ Nx Cloud last updated this comment at |
Bundle Size Benchmarks
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 not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
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
🎓 Learn more about Self-Healing CI on nx.dev
Fixes #7353.
createServerEntryin all three framework adapters importedRegisterfrom the router package (@tanstack/react-router,@tanstack/solid-router,@tanstack/vue-router), while the docs tell users to augment their start package:TypeScript module augmentation is module-scoped, so augmenting
@tanstack/react-starthad no effect on aRegisterimported from@tanstack/react-router. The typedcontextparameter 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
routerregistration (you augment@tanstack/react-routerand import from it). All three packages already re-exportRegisterthrough@tanstack/start-client-core, and the server-entry files already self-import from their own packages (e.g.from '@tanstack/react-start/server'). Changing theRegisterimport 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:
Before:
contextoncreateServerEntry({ fetch })is optional and typed asBaseContextregardless of the augmentation. After:contextis required and typed as{ userId: string } & { nonce?: string }.Summary by CodeRabbit
Release Notes