rare-sapphire
rare-sapphire2w ago

react-query version compatibility issue

I am using @ferdiunal/refine-shadcn library and refine dev libraries for my Next.js. I am using pnpm and it's getting error while install the packages because of react-query version issue. @ferdiunal/refine-shadcn requires ^5.5 but @refinedev/core requires ^4.10.1. So it leads me into several issues and I can't run the project. How to fix this issue?
2 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: ---------------------- You're encountering a common dependency conflict with React Query versions in refine. Currently, @refinedev/core only supports React Query v4 (specifically ^4.10.1), while your @ferdiunal/refine-shadcn library requires React Query v5 (^5.5). This is a known issue in the refine ecosystem. According to the knowledge sources, refine hasn't yet migrated to React Query v5, though there is an open feature request for this (React-Query v5 compatibility). Solutions: 1. Downgrade React Query: The most reliable fix is to explicitly install React Query v4:
pnpm add @tanstack/react-query@^4.10.1

pnpm add @tanstack/react-query@^4.10.1

2. Use a different package manager: Some users reported that this issue is particularly problematic with pnpm due to how it handles peer dependencies. You could try using npm or yarn instead. 3. Force install: As a last resort, you could try using --force with pnpm, but this might lead to runtime errors. Why this happens: This issue occurs because refine uses React Query internally and hasn't yet updated to support v5. According to a comment from the refine team, they're planning to make this update as part of a major release, but they want to ensure stability and proper integration with new features first (GitHub issue comment). The refine team has mentioned that the migration from v4 to v5 involves replacing callbacks with useEffect for notifications in internal logic, and they need to ensure backward compatibility. If downgrading React Query doesn't work for your specific use case, you might need to wait for the official support or consider using a different UI library that's compatible with the current version of refine. ---------------------- 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.

Did you find this page helpful?