Graphql-code-generator: baseOptions should be optional on mutation hooks

Created on 5 Nov 2020  路  6Comments  路  Source: dotansimha/graphql-code-generator

Describe the bug
The baseOptions argument on generated mutation hooks is required, when it should be optional.

To Reproduce
Generate any mutation hook.

Expected behavior
baseOptions will be optional when calling a mutation hook.

Environment:

  • @graphql-codegen/cli: ^1.19.1
  • @graphql-codegen/typescript-react-apollo: ^2.1.0

Additional context

bug plugins waiting-for-release

Most helpful comment

Fix available in @graphql-codegen/[email protected].
@daganomri @gynekolog

All 6 comments

I'll create a PR for skipping this feature for mutations.
Thank you for reporting this @daganomri

Fix available in @graphql-codegen/[email protected].
@daganomri @gynekolog

Should the baseOptions hook only be optional if there are no required variables needed for the mutation? Otherwise this undos #4964 for the mutations case

@bubba
Mutation - always optional, since you can specify it later (while executing), and I think we don't have a way to check that.
Query/Subscription - options are specified on the declaration level ,and now it will depend on the variables.

@dotansimha I didn't realise you could specify variables later. Thanks for clarifying!

Was this page helpful?
0 / 5 - 0 ratings