-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
setQueryData doesn't create a new query #453
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
My team recently attempted to test a component that reads from the cache by creating a dummy data set. We noticed that when using setQueryData, no new queries are created.
import { queryCache } from 'react-query'
queryCache.setQueryData('test', () => ({test: 'test'})); // <-- Should create a new query if missing
console.log('get query cache', queryCache.getQueryData('test')); // <-- Doesn't create a new query
I believe it has something to do in these lines:
https://github.com/tannerlinsley/react-query/blob/master/src/queryCache.js#L186
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request