-
-
Notifications
You must be signed in to change notification settings - Fork 523
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
store.writeQuery On Mutation Only Takes Effect If optimisticResponse Provided #436
Comments
I am also seeing this issue. Seems to not be limited to using the optimistic response though. The optimistic response always works, but sometimes it will revert back to the incorrect state. I am monitoring the data stored in the Apollo cache, and I see values are getting updated correctly, but the UI itself is not matching what is stored in the Apollo store. So there is some weird disconnect (but only is certain scenarios) where the data provided by Vue Apollo does not match what is in the Apollo Store. I am still trying to pin down the exact reproducible steps are. Definitely a new problem. Been using Vue Apollo for about 6 months without this issue. I did update a fair number of packages, so also trying to filter down which package upgrades caused this issue. UPDATE: |
If you follow my link, you will see it's an issue with recent versions of apollo-client and apollo-utilities. |
@Akryum, thanks for the link, and makes sense that it would be upstream. There's a comment there that I did, however, notice that there's no need to do the So I guess bumping the |
It should be fixed in the latest apollo client related packages. |
I struggled for a bit getting updates to the store to work in a reactive way. I could see that
update
on my$apollo.mutate
was being called, and could poke the store and see that the value changed in there, but it wasn't updating the UI. This was for a simple case of adding an item to a list, like the standard Todo example.Only after defining an
optimisticResponse
response on my$apollo.mutate
did things work as expected. I don't see anything in the documentation about this being required. Is this a requirement, or a bug?I still can't get the delete mutation working with
update
. Again, everything looks correct, but no UI update. Without theoptimisticResponse
, nothing visually happens, with it, there's a flash as the item is removed, then put back. The response from the server is simply a boolean, and the optimistic response value istrue
since I expect to to succeed. Switching that tofalse
(so that it actually differs from the server response) has no effect. However, changing anything in the code and letting HMR refresh the code, then trying the delete again succeeds.Any suggestions?
The text was updated successfully, but these errors were encountered: