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
queryClient.resetQueries() does not work as expected for server-hydrated queries. Hydrated query isLoading state is always false, unlike to queries run on client.
What is a proper way to completely reset server-prefetched queries then?
Why the state after hydration is considered to be the inital state?
As mentioned in docs about SSR, queries are being "prefetched" on server. When you prefetch a query on the client, its inital state is the state before any load, not the state after prefetch, unlike to server-prefetch queries.
In my opinion, query reset should reset query to its pre-loaded state, not after-hydration state.
Describe the bug
queryClient.resetQueries()
does not work as expected for server-hydrated queries. Hydrated queryisLoading
state is alwaysfalse
, unlike to queries run on client.Your minimal, reproducible example
https://codesandbox.io/p/devbox/admiring-frog-rnw27x
Steps to reproduce
There is server-prefetched request with post id = 1;
reset posts queries
(it callsqueryClient.resetQueries
);isLoading
state is alwaysfalse
;increase id
button and wait for new post to load;reset posts queries
again;isLoading
state becomestrue
for a moment;#1
to ensure thatresetQueries
is not able to reset server-prefetched queryExpected behavior
queryClient.resetQueries
is able to reset any query, wether its server fetched or client fetchedHow often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
OS: Windows, browser: Chrome 124.0.6367.78 / Firefox 125.0.2
Tanstack Query adapter
vue-query
TanStack Query version
5.32.0
TypeScript version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: