T
TanStack2w ago
ratty-blush

"No QueryClient set" after react-query update to 5.85.6.

Hey 👋🏽 today I updated my react-query dependency in a react app from 5.85.5 to 5.90.1, which uses tanstack/react-router. Suddenly I get "No QueryClient set, use QueryClientProvider to set one errors, but only in production (what bit me 😅 ). I also noticed that the bundle size has been increased by 10 kb (unzipped). I took a closer look and found that the error does not occur with 5.85.5, but does occur with 5.85.6 and higher. Maybe somebody know what's going on. Here's the return of my main.jsx
ReactDOM.createRoot(document.getElementById("root")).render(
<React.StrictMode>
<APIClientProvider value={apiClient}>
<QueryClientProvider client={queryClient}>
<RouterProvider router={router} />
<ReactQueryDevtools />
</QueryClientProvider>
</APIClientProvider>
</React.StrictMode>
);
ReactDOM.createRoot(document.getElementById("root")).render(
<React.StrictMode>
<APIClientProvider value={apiClient}>
<QueryClientProvider client={queryClient}>
<RouterProvider router={router} />
<ReactQueryDevtools />
</QueryClientProvider>
</APIClientProvider>
</React.StrictMode>
);
As I said, in development, everything works fine, in production I get No QueryClient set, use QueryClientProvider to set one-errors. Furthermore my asset-size increases by about 12 kb (unzipped) Thanks
4 Replies
genetic-orange
genetic-orange2w ago
that really sounds like you have two versions of RQ now
ratty-blush
ratty-blushOP2w ago
Thanks @TkDodo 🔮 . You're absolutely right. But it's very weird. I do indeed have a pnpm mono-repo with a package that has react-query as a peer dependency. The app we are talking about has this package as a dependency. package.json of shared-features
"peerDependencies": {
"@tanstack/react-query": "^5.28.14"
//...
}
"peerDependencies": {
"@tanstack/react-query": "^5.28.14"
//...
}
package.json of app
"dependencies": {
"@tanstack/react-query": "^5.85.5",
"@tanstack/react-query-devtools": "^5.85.5",
"shared-features": "workspace:*",
//...
}
"dependencies": {
"@tanstack/react-query": "^5.85.5",
"@tanstack/react-query-devtools": "^5.85.5",
"shared-features": "workspace:*",
//...
}
Can you explain how there can be two different versions in the prod-build? In my opinion, only 5.85.5 should be included in the build. Thanks
genetic-orange
genetic-orange2w ago
I'd check what your lock file says
ratty-blush
ratty-blushOP19h ago
Thanks!

Did you find this page helpful?