Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@dev-plugins/react-query - where should I put the useReactQueryDevTools call in an expo-router app? #46

Closed
drazik opened this issue Aug 4, 2024 · 1 comment

Comments

@drazik
Copy link

drazik commented Aug 4, 2024

Hello,

I am trying to use @dev-plugins/react-query in an Expo app using expo-router. I am using Expo SDK 50 and expo-router 3.4.8.

I tried to put the useReactQueryDevTools(queryClient) call in my RootLayout component, but it doesn't show anything in the app or in the terminal. I don't know what I should expect to see, so I don't know if it's working but I'm not searching the devtools at the right place or if it doesn't work.

What I do (I removed extra stuff that has nothing to do with react-query):

import { QueryClient } from "@tanstack/react-query"
import { createAsyncStoragePersister } from "@tanstack/query-async-storage-persister"
import { PersistQueryClientProvider } from "@tanstack/react-query-persist-client"
import AsyncStorage from "@react-native-async-storage/async-storage"
import { useReactQueryDevTools } from "@dev-plugins/react-query"
import { Slot } from "expo-router"

const queryClient = new QueryClient()

const persister = createAsyncStoragePersister({
  storage: AsyncStorage,
  throttleTime: 3000,
})

export default function RootLayout() {
  useReactQueryDevTools(queryClient)

  return (
    <PersistQueryClientProvider
      persistOptions={{ persister }}
      onSuccess={() =>
        queryClient
          .resumePausedMutations()
          .then(() => queryClient.invalidateQueries())
      }
      client={queryClient}
    >
      <Slot />
    </PersistQueryClientProvider>
  )
}

Does anybody know what I'm doing wrong?

@drazik
Copy link
Author

drazik commented Aug 4, 2024

Just sorted it out: I had to press Shift+M in the terminal to show more tools, then a list of the devtools appeared and "Open devtools plugin - @dev-plugins/react-query" was listed here. It opened the devtools UI in my web browser. The devtools show no data at all, but it may be related to #39

Edit: Yes, the lack of data was related to an outdated chrome version.

@drazik drazik closed this as completed Aug 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant