Skip to content
Source
Sign inSign up
TanStack/cli

Removing tanstack query provider causes integration to stop working #372

Send to my agent
ClosedLighno(GitHub profile, opens in a new tab) opened this issue 1 comment

Which project does this relate to?

Create Tanstack App

Describe the bug

Creating a new app using @tanstack/cli@latest create app --package-manager bun --add-ons tanstack-query creates a faulty app

Your Example Website or App

https://stackblitz.com/~/github.com/Lighno/tanstack-repro

Steps to Reproduce the Bug or Issue

  1. Create a new app using @tanstack/cli@latest create app --add-ons tanstack-query
  2. Run the dev command
  3. Go to the site

Expected behavior

No import errors

Screenshots or Videos

No response

Platform

  • OS: Linux
  • Browser: Chrome, Safari, Firefox
  • Version: [e.g. 91.1]

Additional context

I think the following commit 46a49033547f7e6c9905f4e94cca07ce0988f63a is what caused this, I'd be happy to make the fix if someone could explain what the necessary change is as I'm not sure if you need to change the config from being a provider to something else or remove the provider section from the addon config

  1. import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
    
    export function getContext() {
      const queryClient = new QueryClient()
      return {
        queryClient,
      }
    }
    
    
    export default function TanStackQueryProvider({ children }: { children: React.ReactNode }) {
      const { queryClient } = getContext()
      return (
        <QueryClientProvider client={queryClient}>
          {children}
        </QueryClientProvider>
      )
    }

    Replace above code with current code in root-provider.tsx file

  2. tannerlinsley closed this

Sign in to join this conversation.