-
Notifications
You must be signed in to change notification settings - Fork 787
Conversation
Internally the graphql hoc uses the Mutation comp and passes the mutate func along, so the typing should reflect this
These callbacks get passed from the hoc to the Mutation comp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @danilobuerger - thanks very much!
I think the return type of Example of what we need to do in order to satisfy type safety: withHandlers<Props, HandlerProps>({
handleConfirmSubmit: (props: GraphqlProps) => async (formData: ConfirmSubmitFormData) => {
- const { data } = await props.createStuffMutator.mutate({ variables: formData })
- doStuffWith(data)
+ const response = await props.createStuffMutator.mutate({ variables: formData })
+ if (typeof response === "object") {
+ const { data } = response
+ doStuffWith(data)
+ }
}
})
|
@williamboman Any chance you could submit a PR to improve this? Thanks! |
Sure! I'm not sure whether it's a correct assumption to make that |
@williamboman the return type of |
MutationFunc
in favor ofMutationFn
.Internally the
graphql
hoc uses theMutation
comp and passes themutate
func along, so the typing should reflect this
MutationOpts
These callbacks get passed from the hoc to the
Mutation
comp