You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$dataRefetchIntervalS as reactive store can be changed and should cause that streamsQuery would react to a new value, but its not. StreamsQuery updates it's options only when unmounted and mounted again - while for e.g changing routes withing app.
this is a general design decision in the query core. Calling queryClient.setQueryDefaults is not an operation that has any effect on already existing queries - the defaults are only taken into account when the query is created.
Hi @TkDodo. I'm trying to do basically the same thing: dynamically modify staleTime (with a call to the backend that gets as response a fetching configuration that includes a staleTime value). How would I make this work? I have tried doing queryClient.removeQueries() after setting calling queryClient.setDefaultOptions() and it still doesn't work.
I figured out the problem... :D I didn't take the documentation's advice to heart (regardingstable query client) and I was invalidating queries on the wrong QueryClient instance. I didn't know it was creating multiple instances, so I fixed it and made it a singleton and everything works perfectly fine.
Describe the bug
I have initialized QueryClient in main +layout.svelte:
then, somewhere in my app on route /example i have:
$dataRefetchIntervalS
as reactive store can be changed and should cause that streamsQuery would react to a new value, but its not. StreamsQuery updates it's options only when unmounted and mounted again - while for e.g changing routes withing app.Your minimal, reproducible example
https://stackblitz.com/edit/stackblitz-starters-megwxq?description=React%20%20%20TypeScript%20starter%20project&file=src%2Findex.tsx,src%2FApp.tsx&title=React%20Starter
Steps to reproduce
Reproducted the same behaviour in react and works fine.
Expected behavior
Queries should react to defaultOptions changed by queryClient.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Tanstack Query adapter
svelte-query
TanStack Query version
5.0.0-beta.15 but also in stable version
TypeScript version
5.0.0
Additional context
No response
The text was updated successfully, but these errors were encountered: