Replies: 2 comments
-
can you show this behaviour in a codesandbox reproduction please? |
Beta Was this translation helpful? Give feedback.
0 replies
-
My issue was I was updating my data with the data.results object when I needed to pass in the whole data object. It works now :) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a custom hook that looks something like this:
My data in data.results is an array of objects. When I call addData it creates a copy of my current data, mutates it, then calls setData where queryClient.setQueryData is called with a new array of objects passed in as my second argument.
Expected Behaviour
Cached data updates with the newData passed into the second argument of
queryClient.setQueryData
and component hooked up to useData() hook re-renders with the updated dataActual Behaviour
Cached data either doesn't update or becomes undefined in the component hooked up to the useData() hook
Does anyone know what I'm doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions