-
I just upgraded to the latest TanStack Query (Vue) and I noticed |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
You can do:
that is the same as setting |
Beta Was this translation helpful? Give feedback.
-
I use |
Beta Was this translation helpful? Give feedback.
That's the default behaviour, yes, but it has nothing to do with
placeholderData
. When you navigate through your app, you likely change components, and those have different useQuery calls, observering different parts of the cache. When cached data is available, you'll always get it plus potentially a background refetch (stale-while-revalidate).What
keepPreviousData
(and the placholderData function replacement in v5) does is give you data from the previous query when you change from one query to the next in the same observer (component). That usually happens when the queryKey changes. It's meant to give …