Edit:
Found the answer. If I set resultCaching
to false in the client options the object is recognized to be new and the data updates…
Like the title says, I am using useQuery
to return a data
object, but when the cache updates, the data
object does not! It’s also not updating when the query is sent as a network request. The initial query returns an accurate data
object, but if I do a mutation then unmount → remount the component, a network request is made that returns the correct data, but the data
object is never updated! This also happens when I set the fetchPolicy
to “network-only”.
If I remove the cache options from the ApolloClient
constructor, effectively removing the cache from the equation, the data
object is now updated properly.
Passing refetchQueries
to the mutation function results in data
updating properly.
The mutated data is nested, so I feel like maybe there is some kind of comparison going on that’s stopping the update. If I also update an immediate child field to test it, data
does update… but the nested values are still stale!
I’ve also tried setting returnPartialData: true
. Nothing.
Any idea of what I’m doing wrong?