What is the expected behaviour of `setQueryData(aKey, undefined)` on v5 according to documentation?
Documentation (https://tanstack.com/query/v5/docs/react/reference/QueryClient#queryclientsetquerydata)
If the value is undefined, the query data is not updated.
But in my case the data is set to undefined
. Does not follow the doc's descriptionQueryClient | TanStack Query Docs
QueryClient
The QueryClient can be used to interact with a cache:
2 Replies
extended-salmon•2y ago
Codesandbox reproduction?
wise-white•2y ago
We definitely bail out if you pass undefined:
https://github.com/TanStack/query/blob/9b1aa77010637506b929f529a12bd6dfc6f9001a/packages/query-core/src/queryClient.ts#L170-L174
GitHub
query/packages/query-core/src/queryClient.ts at 9b1aa77010637506b92...
🤖 Powerful asynchronous state management, server-state utilities and data fetching for the web. TS/JS, React Query, Solid Query, Svelte Query and Vue Query. - TanStack/query