Skip to content
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

update is not called in mutation when fetchPolicy set to 'no-cache' #3401

Closed
aunz opened this issue May 4, 2018 · 3 comments
Closed

update is not called in mutation when fetchPolicy set to 'no-cache' #3401

aunz opened this issue May 4, 2018 · 3 comments

Comments

@aunz
Copy link

aunz commented May 4, 2018

Intended outcome:
update option should be called when executing client.mutate({ ... })

Actual outcome:
update is not called when executing client.mutate({ fetchPolicy: 'no-cache' })

How to reproduce the issue:
https://codesandbox.io/s/o98ylor0m5

Version

  • apollo-client@2.3.0
@reeceaw
Copy link

reeceaw commented Jun 27, 2018

I'm getting this too

@hwillson
Copy link
Member

hwillson commented Aug 2, 2018

client.mutate's update option/callback is intended to be used only when you want to interact with the data store (cache). The update callback itself gets sent a proxy to access the data store, as well as the result of the mutation. When you're using no-cache you shouldn't be interacting with the data store at all. If you want to fire actions after the mutation has completed, use the Promise returned from the client.mutate call.

I am marking this as a bug though, since the docs really aren't very clear about this. I'll get them updated. Thanks!

@hwillson
Copy link
Member

hwillson commented Aug 2, 2018

Addressed in #3774. Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants