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.
No description
7 Replies
gmasid
gmasid•5mo ago
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
Vishal
VishalOP•5mo ago
Tried this too, same issue.
gmasid
gmasid•5mo ago
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?
Isreal23
Isreal23•4mo ago
were you able to implement using the extension icon to toggle visibility of the content.tsx?
Vishal
VishalOP•4mo ago
@Isreal23 Yes I was able to figure that out @gmasid After rebuilding it's working, though still throwing errors sometimes in dev mode.
Isreal23
Isreal23•4mo ago
@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.
gmasid
gmasid•4mo ago
Throw errors while developing its normal, specially “Context invalidated”. It gives some error specific about react query?

Did you find this page helpful?