useSWRMutation - to have both trigger
and triggerAsync
#2310
Unanswered
anirudh1713
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
CONTEXT
Continuing the discussion from #1973
Currently
useSWRMutation
returns atrigger
method which returnsPromise<Data>
which may cause confusion like here. though it should be clear to developers if they just take a look at thetypes
however that is not the only reason for this request, developers might just want to use theonError
callback and don't want to bother catching errors manually.Proposal
It may be better to return both
trigger
andtriggerAsync
, wheretrigger
will returnvoid
andtriggerAsync
will returnPromise<Data>
(or vice versa) 🤔This is similar to #1951
Beta Was this translation helpful? Give feedback.
All reactions