Query selector returning old data
I have an API that returns the new record on create/update so I am using setQueryData inside the update mutation to update the cache instead of invalidating and refetching.
In my app I show the list of records, with an option to hide some inactive records.
And here is the custom hook:
If I update the record to be inactive, it will dissapear when onlyShowActive is ticked.
When I untick onlyShowActive the record appears again.
But then when I update the record back to active, and tick onlyShowActive, the record is not shown, even though in react query devtools I can see that the record is correctly marked as active.
1 Reply
exotic-emeraldOP•4y ago
Nevermind. I fixed it by adding
And changing the useGetRecordsQuery call to