Allow passing no `input` on mutations with optional/no input
See original GitHub issueWhen no input
is specified for a mutation on the back-end, the corresponding useMutation
hook shouldn’t require any variables to be given. Unfortunately, this isn’t the case over here:
With code similar to:
const { mutate: softCancelSubscription } = trpc.useMutation(["WithoutInput"]);
mutate(); // Type checking fails when no parameter is given
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Optional argument - Mutation - TypeGraphQL - Stack Overflow
To make an argument optional, pass a second parameter to the @Arg decorate like this: @Arg('firstName', { nullable: true }) firstName: ...
Read more >6.4. Mutations should clearly describe all the ... - GraphQL Rules
The problem is that in this case, it is necessary to specify the input parameters as optional, which can lead to errors, because...
Read more >Passing optional arguments to Mutation for connections
I am trying to write a mutation resolver function for passing an optional argument for a comment to reference either null if no...
Read more >Mutations in Apollo Client - Apollo GraphQL Docs
Inside it, we'll pass our ADD_TODO mutation to the useMutation hook: JavaScript. add-todo.jsx. 1. function AddTodo() {. 2. let input;.
Read more >Mutations and Input Types - GraphQL
You don't need anything more than this to implement mutations. But in many cases, you will find a number of different mutations that...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Re-opening as it’d be a nice feature.
This issue has been locked because it had no new activity for 14 days. If you are running into a similar issue, please create a new issue. Thank you.