QueryClient not found
I am using react query in the content script
This is how my code looks like, and it's even "working".
But I still get this error on console that no QueryClient provided.
Help.

7 Replies
why put queryClient inside a useState?
try to declare it outside of this context to prevent rerenders
try like this and see if it works:
src/lib/query-client.ts:
import { QueryClient } from '@tanstack/react-query';
export const queryClient: QueryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnWindowFocus: false,
},
},
});
change the options as you need of course
Tried this too, same issue.
weird, i have a chrome extension running fine with react query. can you send a link to repo so i can try to see where is wrong?
were you able to implement using the extension icon to toggle visibility of the content.tsx?
@Isreal23 Yes I was able to figure that out
@gmasid After rebuilding it's working, though still throwing errors sometimes in dev mode.
@Vishal please can you help me with how to make it work.. I'd really appreciate.
https://discord.com/channels/946290204443025438/1374898067471470692
Please help check here to drop your solution.
Throw errors while developing its normal, specially “Context invalidated”. It gives some error specific about react query?