Describe the bug#
refetchOnMount: 'always' does not trigger an API refetch with persister, as the first fetch for a query with persister is to load from the store and not API call.
Your minimal, reproducible example#
TBA
Steps to reproduce#
- Use
useQuery with refetchOnMount: 'always', persister, and staleTime.
- Open browser network tab and reload the page, no API call is made.
Expected behavior#
An API call is made to refetch the data.
How often does this bug happen?#
Every time
Screenshots or Videos#
No response
Platform#
Tanstack Query adapter#
None
TanStack Query version#
v5.90.7
TypeScript version#
No response
Additional context#
No response
If we are talking about
createPersisterthenrefetchOnRestoreoption should potentially solve your issue.https://tanstack.com/query/latest/docs/framework/react/plugins/createPersister#options