-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The 'QueryClient' type does not have queryCache, mutationCache, defaultOptions, queryDefaults and four other properties of the 'QueryClient' type. #9684
Comments
I ran this code locally and I'm not getting any errors. My Chrome version is different from yours but I'm not getting this error in Firefox either. Do you still get import { Admin } from "react-admin";
import { QueryClient } from "react-query";
import fakeDataProvider from "ra-data-fakerest";
const dataProvider = fakeDataProvider({
posts: [
{ id: 0, title: "Hello, world!" },
{ id: 1, title: "FooBar" },
],
comments: [
{ id: 0, post_id: 0, author: "John Doe", body: "Sensational!" },
{ id: 1, post_id: 0, author: "Jane Doe", body: "I agree" },
],
});
const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 1000 * 6 * 5,
refetchOnWindowFocus: false,
},
},
});
const App = () => (
<Admin queryClient={queryClient} dataProvider={dataProvider}></Admin>
);
export default App; Environment
|
@Nela62 If you look at the 'Environment' part of the issue I published, you can see that I am using the latest version, @tanstack/react-query v5. You are importing After creating a new project, I installed React-query(older version) and passed queryClient, but no error occurred. However, if I pass queryClient from @tanstack/react-query, I still get an error. Since it has been migrated to v5, I think it is right to import |
react-admin uses react-query v3. We're working on integrating tanstack query in I'm closing this issue because there is nothing wrong with react-admin in this case: you must use react-query v3. |
What you were expecting:
To set React Query's
staleTime
, I created aQueryClient
instance, setdefaultOptions.queries.staleTime
, and passed it to thequeryClient
props in theAdmin
component as described in the official documentation.I expected it to work the same as passing it to
QueryClientProvider
, but I get an error message saying a required property is missing.What happened instead:
I get the following error message: The 'QueryClient' type does not have queryCache, mutationCache, defaultOptions, queryDefaults and four other properties of the 'QueryClient' type.
Related code:
Environment
I don't know if this is basic behavior or if I'm missing something. I couldn't find any related documents or content either.
The text was updated successfully, but these errors were encountered: