-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Labels
Description
Describe the bug
In solid-query v5, if you use placeholderData: keepPreviousData with a query that returns arrays, the cacheing breaks and returns the wrong results when returning to previously fetched queries.
See the demonstration in the attached video and codesandbox. In the codesandbox, the returned result should always match with the search property. This works fine when NOT using placeholderData. However, with placeholderData on, the query.data values seem to get out of sync with the latest query key.
Your minimal, reproducible example
https://codesandbox.io/s/solid-query-placeholder-broken-392lsq?file=/index.js
Steps to reproduce
- Type in "a". Notice that the correct result gets returned
- Type in "ac". Notice that correct result gets returned
- Delete "c" to return to "a", which should be cached. Notice that the query returns the wrong data
Expected behavior
When using placeholderData, the query cache should return the same values as if you weren't using placeholderData.
How often does this bug happen?
Every time
Screenshots or Videos
solid-query-placeholder-bug.mp4
Platform
OSX, Chrome
Tanstack Query adapter
None
TanStack Query version
v5 beta 23
TypeScript version
No response
Additional context
No response