-
Notifications
You must be signed in to change notification settings - Fork 787
graphql(mutation) HOC result prop is not updated #3250
Comments
We are seeing the same issue and it is a result of this line, which unfortunately sets https://github.com/apollographql/react-apollo/blob/master/packages/hoc/src/mutation-hoc.tsx#L69 Other tickets related to this have been closed, but I am not sure why, as the issue is not yet fixed (e.g. #2952). A different fix was applied as part of PR #3008 However, because Is there any good reason |
No, it may not return the results from |
Any updates on this issue? |
We are using recompose and until this resolves, we are using withMutation = (mutation, options) =>
fromRenderProps(
({ children: propsMapper }) => <Mutation {...{ ...options, mutation }}>{propsMapper}</Mutation>,
function propsMapper(mutate, result) {
return { mutate, result };
}
); Hope this will be solved soon. |
Hi all - we can't just remove export default graphql(Mutation, { options: { ignoreResults: false } })(App); I'll modify PR #3431 to add this in. Thanks! |
* Fixed withMutation hoc allowing updates to result Fixes #3250 * Allow internal `ignoreResults` setting to be overridden In some cases it can be beneficial to receive result updates in `withMutation`. This commit tweaks `withMutation` such that developers can override the currently always on `ignoreResults` setting. * Changelog update
When using the
graphql(mutation)(Component);
pattern, theresult
prop injected into the component does not reflect the proper state of the mutation as it does when just using theMutation
component.related source file: https://github.com/apollographql/react-apollo/blob/master/packages/hoc/src/mutation-hoc.tsx#L73
Intended outcome:
result
prop injected fromgraphql
wrapper includes proper loading and called state ofmutate
callback.Actual outcome:
The
result
prop always shows{ loading: false, called: false }
How to reproduce the issue:
client reproduction: https://codesandbox.io/s/apollo-reproduction-ozm2g
basic server: https://codesandbox.io/s/apollo-server-2il37
Basic Implementation:
Version
The text was updated successfully, but these errors were encountered: