question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow passing no `input` on mutations with optional/no input

See original GitHub issue

When 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:

image

With code similar to:

const { mutate: softCancelSubscription } = trpc.useMutation(["WithoutInput"]);

mutate(); // Type checking fails when no parameter is given

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
KATTcommented, May 20, 2021

Re-opening as it’d be a nice feature.

0reactions
github-actions[bot]commented, Oct 4, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found