I am getting TypeError: this[#client].defaultMutationOptions is not a function error

I used @ferdiunal/refine-shadcn in my Next.js project, and copied same code in the example but getting I am getting TypeError: this[#client].defaultMutationOptions is not a function error. I searched about that but everyone says it's react-query problem. How to fix this issue?
3 Replies
kapa.ai
kapa.ai2w ago
Hi @Ghostman. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the knowledge sources, this error is related to a version compatibility issue with React Query. The error message TypeError: this[#client].defaultMutationOptions is not a function typically occurs when you're using React Query v5 with Refine, which currently only supports React Query v4. Several users have reported this same issue in the GitHub issues: 1. In issue #6408, users experienced this error when using React Query v5 with Refine. The solution was to explicitly install v4 of React Query. 2. In issue #6433, a Refine team member confirmed that they don't support React Query v5 yet and pointed to an ongoing issue tracking the upgrade. To fix this issue, you need to: 1. Check your package.json for the React Query version 2. If you're using React Query v5, downgrade to v4:
npm install @tanstack/react-query@^4.10.1
npm install @tanstack/react-query@^4.10.1
Or with yarn:
yarn add @tanstack/react-query@^4.10.1
yarn add @tanstack/react-query@^4.10.1
If you're using a monorepo or have other packages that depend on React Query v5 (like tRPC v11), you might face additional challenges as mentioned in issue #6433. The Refine team is aware of this issue and has an open ticket (issue #5370) to upgrade to React Query v5, but it's not active yet as it requires breaking changes. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@1014424596260343818> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
extended-salmon
extended-salmonOP2w ago
Then I am getting the other error
TypeError: Cannot read properties of undefined (reading 'list')
TypeError: Cannot read properties of undefined (reading 'list')
How to fix this?

Did you find this page helpful?