Did react query use to lock/freeze data before?
To put it simply, lets say that I return a list of todos from a queryFn, and if I try to mutate that array within mutateFn by just pushing to the same array I would get an error about it being locked/frozen. Now it seems its no longer the case.
Did anything change regarding that?
1 Reply
conscious-sapphire•3y ago
we've never frozen anything, but it's definitely necessary to do immuable updates
https://tanstack.com/query/v5/docs/react/guides/updates-from-mutation-responses#immutability
Updates from Mutation Responses | TanStack Query Docs
When dealing with mutations that update objects on the server, it's common for the new object to be automatically returned in the response of the mutation. Instead of refetching any queries for that item and wasting a network call for data we already have, we can take advantage of the object returned by the mutation function and update the exis...