refinedev/refine

[BUG] Unable to implement custom queryclient for invalidating custom queries

Closed this issue · 1 comments

Describe the bug

I wanted to create a useCustomInvalidate hook to be able to invalidate custom queries (especially the getIdentity query).

My issue follows this issue. I saw it was closed, but I am facing exactly similar issues at my end

I downgraded the version of react-query I installed to 4.36.1

and I'm getting TypeError: Cannot read properties of undefined (reading 'queryCache') when I try to call the queryClient.invalidateQueries

Steps To Reproduce

Same as in the referenced issue

Expected behavior

Should be able to use the @tanstack/react-query client in a component wrapped inside the Refine provider

Packages

List of packages:
"@ant-design/icons": "^5.0.1",
"@refinedev/antd": "^5.37.2",
"@refinedev/cli": "^2.7.4",
"@refinedev/core": "^4.32.0",
"@refinedev/devtools": "^1.1.30",
"@refinedev/inferencer": "^4.5.17",
"@refinedev/kbar": "^1.3.5",
"@refinedev/nextjs-router": "^5.5.5",
"@refinedev/simple-rest": "^5.0.1",
"@refinedev/supabase": "^5.7.5",
"@supabase/supabase-js": "^2.7.0",
"@tanstack/react-query": "^5.17.9",
"@tinymce/tinymce-react": "^4.3.0",
"antd": "5.8.1",
"antd-img-crop": "^4.18.0",
"clipboard-polyfill": "^2.8.5",
"next": "^13.5.1",
"nextjs-cors": "^2.1.2",
"nookies": "^2.5.2",
"react": "^18.0.0",
"react-animated-css": "^1.2.1",
"react-dom": "^18.0.0",
"react-markdown": "^9.0.1",
"react-phone-input-2": "^2.15.1",
"react-transition-group": "^4.4.5",
"sass": "^1.64.2",
"supertokens-auth-react": "^0.35.4",
"supertokens-web-js": "^0.8.0",
"tinymce": "^6.7.0",
"tus-js-client": "^3.1.1"

Additional Context

No response

Apparently, the issue was also discussed in this discord chat

so, destructuring the invalidateQueries won't work:
image

But this does:
image

I'll close the issue then. Thanks for the great work on this!