TanStackT
TanStack2y ago
4 replies
then-purple

Is there a way to manually set the entire cache to a new value?

I need to update a value that appears in many places so I wanted to avoid passing a queryKey to setQueryData(). I've written a recursive function that gets the entire cache and updates every occurance of the value and returns a new array. How can I set the cache to this new array?

(If there is a better way of doing what I'm doing I'm open to suggestions)

Thanks
Was this page helpful?