-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates not broadcasted to UI when using writeQuery(). Works when using writeFragment() #4070
Comments
Getting the same issue but inside a mutation |
See: #4031 (comment) |
The reason for this is explained in the Direct Cache Access section of the docs:
|
Hi @hwillson , Question:
After trying many times, I ended up with codes updating both UI and caches in my project:
In this line: This doesn't look okay to me as I saw people saying it needs to be "immutable" or "passing new object", etc. It should only work I pass a new object using like lodash's cloneDeep of I am confused what's the reason makes the UI changed successfully |
In a resolver for apollo-link-state I am updating an array and writing back to cache with writeQuery()
The updates are not broadcasting to UI. componentShouldUpdate() is not getting hit.
If I use writeFragment() on the specific items instead of writeQuery() it will broadcast.
Note also that I am not mutating cache results but cloning first, mutating clones, and rewriting.
apollo-cache-inmemory 1.3.6
apollo-client 2.4.3
react-apollo 2.2.4
The text was updated successfully, but these errors were encountered: