-
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
defaultOptions.mutate.fetchPolicy is ignored by useMutation #5978
Comments
benjamn
added a commit
that referenced
this issue
Jul 28, 2020
Should fix #5978, using an approach inspired by trojanowski/react-apollo-hooks#77.
Fix incoming (sorry for the long wait!): #6715 |
benjamn
added a commit
that referenced
this issue
Jul 28, 2020
* Avoid clobbering default options with undefined values. Should fix #5978, using an approach inspired by trojanowski/react-apollo-hooks#77. * Mention PR #6715 in CHANGELOG.md.
Thanks for the fix @benjamn ! |
Following up: we just published |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Intended outcome:
Setting
defaultOptions.mutate.fetchPolicy
in client instantiation should result in the option being used byuseMutation
whenuseMutation
doesn't override the value.Actual outcome:
useMutation
passes{ fetchPolicy: undefined }
which ends up overriding the default fetchPolicy when defaultOptions are spread with override options.Bad object merging:
apollo-client/src/ApolloClient.ts
Lines 345 to 348 in 0340c48
Called with undefined fetchPolicy from:
apollo-client/src/react/data/MutationData.ts
Lines 101 to 112 in a38a2ca
Related issues / fixes:
#3256 (dup of this issue, but it was closed to due inactivity)
trojanowski/react-apollo-hooks#77 (related fix for same bug in
react-apollo-hooks
)#3717
How to reproduce the issue:
defaultOptions.mutate.fetchPolicy
set tono-cache
.useMutation
without specifying any optionsVersions
The text was updated successfully, but these errors were encountered: