Describe the bug#
The doc says
If you configure your query observer with initialData, and no staleTime (the default staleTime: 0), the query will immediately refetch when it mounts:
But like the codesandbox I pasted here, the useQuery will not refetch immediately if I set the initialData param in the option.
Your minimal, reproducible example#
https://codesandbox.io/p/devbox/nuxt-vq-in-mlq5h9?file=%2Fapp.vue%3A10%2C28
Steps to reproduce#
In the codesandbox
Expected behavior#
Works as the doc says.
How often does this bug happen?#
Every time
Screenshots or Videos#
No response
Platform#
macOS 3.2.1 (22D68) Apple M2
Chrome Version 125.0.6422.112
"@hebilicious/vue-query-nuxt": "^0.3.0",
"@tanstack/vue-query": "^5.40.0",
Tanstack Query adapter#
None
TanStack Query version#
^5.40.0
TypeScript version#
No response
Additional context#
No response
you are using
@hebilicious/vue-query-nuxtwhich sets the default staleTime to 5 seconds:https://github.com/Hebilicious/vue-query-nuxt/blob/c6f88bc1a61e04870e0ebd93ba600f2bb85e0932/packages/vue-query-nuxt/src/runtime/utils.ts#L29
please consult their docs on how to customize that. you can also pass
staleTime:0touseQueryto see that it works just fine.