We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
useSuspenseQuery
persister
I would like to pre-cache useQuery data, so when the user visits app a second time, the app will show stale data, and refetch in background.
useQuery
I used persisted with useQuery before it was working as expected, but when I switched to useSuspenseQuery, the cached data is not used anymore.
const queryClient = new QueryClient({ defaultOptions: { queries: { gcTime: 1000 * 60 * 60 * 24 * 7, // 7 days staleTime: 0, }, }, }); // ... function App() { useSuspenseQuery({ queryKey: ['test'], queryFn: async () => { await sleep(1000); return 'ok'; }, }); return <div>App is ready. Data cached. Try to reload</div>; }
https://stackblitz.com/edit/vitejs-vite-ihky3z?file=index.tsx
localStorage
The loader should not be shown for second time.
None
No response
react-query
5.62.2
5.7.2
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
I would like to pre-cache
useQuery
data, so when the user visits app a second time, the app will show stale data, and refetch in background.I used persisted with
useQuery
before it was working as expected, but when I switched touseSuspenseQuery
, the cached data is not used anymore.Your minimal, reproducible example
https://stackblitz.com/edit/vitejs-vite-ihky3z?file=index.tsx
Steps to reproduce
localStorage
Expected behavior
The loader should not be shown for second time.
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
Tanstack Query adapter
react-query
TanStack Query version
5.62.2
TypeScript version
5.7.2
Additional context
No response
The text was updated successfully, but these errors were encountered: