Optional mutation type for the parameter of select
in MutationStateOptions
#8047
Unanswered
mohamedhamza12
asked this question in
Ideas
Replies: 1 comment 1 reply
-
if you want to narrow error states, it has to be either globally with module augmentation or by doing runtime type narrowing (which is preferred) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, I'm currently working with gRPC endpoints using grpc-web and @tanstack/react-query. Because of this, if a mutation fails the type of error it returns is
RpcError
. I'm usinguseMutationState
to return a an array of mutations but passingselect
to its options to return the error of each mutation always expects the error to be of typeError
. My suggestion is passing an extra optional generic type parameter touseMutationState
representing the mutation type, so something similar to the following:This would enable me to use the hook as follows:
Beta Was this translation helpful? Give feedback.
All reactions