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
use useQueries and return the query-> the previousData is discarded
See the reproduction and increment the input
Both results hold different values
Expected behavior
I don't know if this is a limitation due to how useQueries or keepPreviousData works but I would expect the placeHolderData to be kept around. If that's not possible maybe this could be documented somewhere.
The placeholderData option exists for useQueries as well, but it doesn't get information passed from previously rendered Queries like useQuery does, because the input to useQueries can be a different number of Queries on each render.
It's very hard to know what the "previous" query was in a dynamic list of queries. We tried to be smart and figure out which queries belong together, or only do it if the length didn't change, but even then, you could've swapped things around in the array, and keeping previous data would yield wrong results.
If you think it should be better documented that this doesn't work, please open a PR to the docs.
Describe the bug
Using
keepPreviousData
in useQueries always returns:while the query-function is running.
This produces different results for using the same query.
(See the reproduction)
Your minimal, reproducible example
Reproduction
Steps to reproduce
use
useQuery
-> the previousData is keptuse
useQueries
and return the query-> the previousData is discardedSee the reproduction and increment the input
Both results hold different values
Expected behavior
I don't know if this is a limitation due to how
useQueries
orkeepPreviousData
works but I would expect theplaceHolderData
to be kept around. If that's not possible maybe this could be documented somewhere.How often does this bug happen?
Every time
Screenshots or Videos
Platform
Tanstack Query adapter
react-query
TanStack Query version
v5.24.8
TypeScript version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: