GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix: drop dead imports from generated React templates by WaryaWayne · Pull Request #498 · TanStack/cli Conversation
|
| Scaffold | Before | After |
|---|---|---|
| --add-ons tanstack-query | 3 errors | tsc --noEmit exit 0 |
| --add-ons tanstack-query,tRPC | 4 errors | 1 error (unrelated, below) |
vite build on the tRPC scaffold: exit 0. Unit suites green — 101
@tanstack/cli, 248 @tanstack/create.
Issue #272 ("Provider ... is not used"), closed by #356. The router imports are leftover residue of that fix — the Wrap block got gated, the imports did not. Not a duplicate, the still-live remainder.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The tanstack-query branch of the router template imports ReactNode, QueryClient and the TanstackQueryProvider default export whenever the add-on is enabled, but ReactNode and TanstackQueryProvider are only referenced inside the tRPC `Wrap` block and QueryClient is never referenced at all. Generated projects set `noUnusedLocals: true`, so a fresh scaffold ships code that violates its own tsconfig. Gates the two tRPC-only imports behind `addOnEnabled.tRPC` and removes the QueryClient import outright. setupRouterSsrQueryIntegration is deliberately left alone — it is used, and removing it silently breaks SSR query dehydration.
api.trpc.$.tsx imports createServerFileRoute from
'@tanstack/react-start/server'. The route already uses
`createFileRoute(...)({ server: { handlers } })`, and that symbol is no longer
exported, so the import is both unused (TS6133) and unresolvable (TS2305).
The tRPC branch of root-provider.tsx imports QueryClientProvider but renders
TRPCProvider; setupRouterSsrQueryIntegration is what supplies the query
client.
Generated projects set `noUnusedLocals: true`, so both surface as errors in a
fresh `--add-ons tanstack-query,tRPC` scaffold.
There was an error while loading. Please reload this page.
📝 WalkthroughWalkthroughThe generated React scaffolds now use TanStack Router for the tRPC API route and remove unused or incorrectly unconditional React Query imports from router and provider templates. ChangesGenerated tRPC scaffold
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.changeset/trpc-dead-imports.md:
- Around line 9-12: Update the query-client description in the changeset so it
states that getContext() creates the QueryClient and
setupRouterSsrQueryIntegration receives that existing client to register SSR
query integration, rather than implying the integration supplies or creates the
client.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 450a6105-c47f-499f-beac-68a7691cfc73
.changeset/router-unused-imports.md.changeset/trpc-dead-imports.mdpackages/create/src/frameworks/react/add-ons/tRPC/assets/src/routes/api.trpc.$.tsxpackages/create/src/frameworks/react/add-ons/tanstack-query/assets/src/integrations/tanstack-query/root-provider.tsx.ejspackages/create/src/frameworks/react/project/base/src/router.tsx.ejs
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| and unresolvable. The tRPC branch of `root-provider.tsx` imported | ||
| `QueryClientProvider`, which it never renders — | ||
| `setupRouterSsrQueryIntegration` supplies the query client. Generated projects | ||
| set `noUnusedLocals: true`, so both showed up as errors in a fresh scaffold. |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Correct the query-client description.
getContext() creates the QueryClient; setupRouterSsrQueryIntegration receives that existing client to register SSR query integration. Please adjust this wording so the changeset does not misstate the responsibility of the integration.
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.changeset/trpc-dead-imports.md around lines 9 - 12, Update the query-client
description in the changeset so it states that getContext() creates the
QueryClient and setupRouterSsrQueryIntegration receives that existing client to
register SSR query integration, rather than implying the integration supplies or
creates the client.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.