Add executeAsync #137
Closed
anarkrypto
started this conversation in
Ideas
Replies: 1 comment 3 replies
-
It would surely be useful, and it has already been discussed in: My question is: does |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Tanstack react-query has a very useful method: mutateAsync
It allows us to get a promise which will resolve on success or throw on an error. This can for example be used to compose side effects.
For me it has been very useful in combination with react-hook-form. So I can pass my async mutation to the form's
handleSubmit
and useisSubmitting
,isSubmitted
/isSubmitSuccessful
fromformState
.However it is not possible with next-safe-action currently, we depend 100% of it's internal hook state.
To achieve the same effect of mutateAsync with next-safe-action execute, here is simple example I was working on:
Beta Was this translation helpful? Give feedback.
All reactions