When generating mutation components the variables prop is now always required, which resulted in a lot of type exceptions in our code base.
This GraphQL mutation:
mutation addPersonMutation($name: String!) {
addPerson(name: $name) {
id
name
}
}
is generated like this:
export const AddPersonMutationComponent = (
props: Omit<
Omit<
ReactApollo.MutationProps<
AddPersonMutationMutation,
AddPersonMutationMutationVariables
>,
'mutation'
>,
'variables'
> & { variables: AddPersonMutationMutationVariables }, // variables should be optional for Mutations
) => (
<ReactApollo.Mutation<
AddPersonMutationMutation,
AddPersonMutationMutationVariables
>
mutation={AddPersonMutationDocument}
{...props}
/>
);
My codegen.yml config file:
overwrite: true
schema: 'http://localhost:3000/graphql'
documents:
- 'src/**/*.query.graphql'
- 'src/**/*.mutation.graphql'
generates:
src/generated/graphql.tsx:
plugins:
- typescript
- typescript-operations
- 'typescript-react-apollo'
config:
scalars:
Date: number
noGraphQLTag: false
It's maybe related to PR #1687
Fixed in 1.1.1 馃帀
Most helpful comment
Fixed in 1.1.1 馃帀