orval
orval copied to clipboard
Add a react-query default mutationKey that is the name of the mutation function (e.g. useCreateUser)
What are the steps to reproduce this issue?
Not exactly a reproducible issue other than the fact that generated react-query
mutations do not have mutationKey
s by default.
What happens?
When using a standard orval
configuration for react-query
no mutations have mutationKey
s by default.
What were you ~expecting to~ hoping could happen?
Rather than having to manually add mutationKey
s to every operation by hand, it would be awesome if orval
could add a default mutationKey
that is just the name of the mutator (e.g. useCreateUser
).
This would allow someone (me 😁) to use a single mutationOptions
override to handle case-by-case scenarios for different mutations based on the mutationKey
.
Currently my custom mutationOptions
override gets nicely inserted into each mutation, but there's no way for me to identify within the custom option implementation which mutation is happening. I can only provide generic mutation overrides (e.g. retryDelay
).
With a mutationKey
provided I could know which mutation is happening and then safely perform invalidations or local cache updates within onSuccess
.
Any logs, error output, etc?
No logs or errors.
Any other comments?
n/a
What versions are you using?
Operating System: Ubuntu 22.04
Package Version: 6.25.0
Browser Version: n/a
I'm missing this as well.