Describe the bug
The keepPreviousData options does not seem to work in the svelte-query. Even when set to true the data is empty until the new query is done.
I made the query reactive using the documentation here: https://tanstack.com/query/v4/docs/svelte/reactivity
I think it is because the current syntax will rerun the createQuery method and create a new query object each time any used variable changes, instead of subscribing to change within the already created query object, but I do not know enough about the inner workings of query-core and svelte-query to know if this is indeed an issue.
Your minimal, reproducible example
https://codesandbox.io/s/nifty-cloud-pxwjho?file=/App.svelte
Steps to reproduce
- Create a reactive query with a queryKey with a variable and keepPreviousData set to true
- Render the results to the DOM
- Update the variable
- All results are removed immediately removed from the DOM
- And rendered again when the new query result is available
Expected behavior
As a user, I expected the previous data be visible in the DOM during fetching of the updated data
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: Windows
- Browsers: Chrome 109.0, Firefox 109.0
TanStack Query version
4.22.3
TypeScript version
4.9.4
Additional context
No response
Describe the bug
The
keepPreviousDataoptions does not seem to work in the svelte-query. Even when set to true the data is empty until the new query is done.I made the query reactive using the documentation here: https://tanstack.com/query/v4/docs/svelte/reactivity
I think it is because the current syntax will rerun the
createQuerymethod and create a new query object each time any used variable changes, instead of subscribing to change within the already created query object, but I do not know enough about the inner workings of query-core and svelte-query to know if this is indeed an issue.Your minimal, reproducible example
https://codesandbox.io/s/nifty-cloud-pxwjho?file=/App.svelte
Steps to reproduce
Expected behavior
As a user, I expected the previous data be visible in the DOM during fetching of the updated data
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
TanStack Query version
4.22.3
TypeScript version
4.9.4
Additional context
No response