-
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
remove query
option from hooks with two args
#10527
Conversation
Removes the `query`/`mutation`/`subscription` option from hooks that already take that value as their first argument. These options have not been wired up, but were present in the TS types.
🦋 Changeset detectedLatest commit: 27b69ea The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Nice fix! LGTM ✅
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 good for release-3.8
!
@@ -216,7 +223,6 @@ export interface MutationHookOptions< | |||
TContext = DefaultContext, | |||
TCache extends ApolloCache<any> = ApolloCache<any>, | |||
> extends BaseMutationOptions<TData, TVariables, TContext, TCache> { | |||
mutation?: DocumentNode | TypedDocumentNode<TData, TVariables>; |
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.
I would say the useMutation
hook has some important similarities with useLazyQuery
, since the caller of the mutation execution function can change the mutation
document over time.
However, the options type passed to the mutation execution function is MutationFunctionOptions
(defined further above), which still has an optional
mutation?: DocumentNode | TypedDocumentNode<TData, TVariables>;
field. The only options type losing its mutation
field is MutationHookOptions
.
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.
Yup, that was the goal here - no mutation
field in the hook option, but still a mutation
field in the execution function options.
Just to double-check: you just reiterated that here, there was no change for a request, right?
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.
🎉
Removes the
query
/mutation
/subscription
optionfrom hooks that already take that value as their first argument.These options have not been wired up, but were present in the TS types.
Exception: for
useLazyQuery
this has been hooked up for a very brief period of time through #10499.That code has been adjusted to allow changing the query though the execution function, but not via the hook option.
There have not been any tests for this functionality before, so as long as all existing tests keep passing, we should be fine.
Checklist: