-
-
Notifications
You must be signed in to change notification settings - Fork 123
Description
Which project does this relate to?
Create Tanstack App
Describe the bug
When setting up npm create @tanstack/start@latest, it also creates the folder src/integrations/tanstack-query with two files inside:
root-provider.tsxdevtools.tsx
Inside root-provider.tsx, there is a Provider function (see both tRPC and non-tRPC snippet below)
Lines 46 to 58 in 6110e61
| export function Provider({ | |
| children, | |
| queryClient, | |
| }: { | |
| children: React.ReactNode; | |
| queryClient: QueryClient; | |
| }) { | |
| return ( | |
| <TRPCProvider trpcClient={trpcClient} queryClient={queryClient}> | |
| {children} | |
| </TRPCProvider> | |
| ); | |
| } |
Lines 69 to 79 in 6110e61
| export function Provider({ | |
| children, | |
| queryClient, | |
| }: { | |
| children: React.ReactNode; | |
| queryClient: QueryClient; | |
| }) { | |
| return ( | |
| <QueryClientProvider client={queryClient}>{children}</QueryClientProvider> | |
| ); | |
| } |
They are not used anywhere in the template, and from the page TanStack Query Integration:
By default, the integration wraps your router with a QueryClientProvider. If you already provide your own provider, pass wrapQueryClient: false and keep your custom wrapper.
The code in the template is unused, so it may be removed.
Your Example Website or App
https://tanstack.com/start/v0/docs/framework/react/quick-start
Steps to Reproduce the Bug or Issue
- Create a basic app with
npm create @tanstack/start@latest my-app -- --add-ons tanstack-query - View the contents of
src/integrations/tanstack-query/root-provider.tsxwithcat:
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
export function getContext() {
const queryClient = new QueryClient()
return {
queryClient,
}
}
export function Provider({
children,
queryClient,
}: {
children: React.ReactNode
queryClient: QueryClient
}) {
return (
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
)
}- Look for files where Provider is mentioned with
grep:
$ grep -nr "\bProvider" --exclude-dir=node_modules
src/integrations/tanstack-query/root-provider.tsx:10:export function Provider({As we can see, excluding the file where it was defined, it is not used anywhere else.
Expected behavior
As a user, I expect unused code snippets to not be part of our template. However, in our case, there is a unused code that returns a QueryClientProvider, which is not used anywhere, and which won't be needed, since Router also has Query integration.
Screenshots or Videos
No response
Platform
- OS: Linux
- Browser: Firefox
- Version: 146.0-2
Additional context
No response