-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Docs: update mutate options description #4133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 0c58012:
|
yeah it's intended, but I wouldn't phrase it as "if a promise is returned, it's not awaited". The signature is different, as those callbacks can only return |
Thank you for your reply, but are you sure about the return types? Both MutationOptions interface and MutateOptions have same return types for |
@SirMoustache you are absolutely right. I don't know why we should allow to return a Promise from the mutate callbacks, as we are not awaiting them.
Yes, I'd say so. Would you like to add that to this PR ? |
@TkDodo I have done that, also I changed the wording in docs and explicitly provided a description for mutation callbacks |
Codecov ReportBase: 96.36% // Head: 96.82% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #4133 +/- ##
==========================================
+ Coverage 96.36% 96.82% +0.46%
==========================================
Files 45 58 +13
Lines 2281 2676 +395
Branches 640 786 +146
==========================================
+ Hits 2198 2591 +393
- Misses 80 83 +3
+ Partials 3 2 -1 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Hey, in
useMutation
options docs description foronSuccess
,onError
andonSettled
saysSo in this example, the mutation will wait for the promise in
onSuccess
to be resolved before changing mutation status and dataIt also says in
mutate
optionsBut if used like this the promise will not be awaited
As I understand, this is intended behavior, so I want to update the docs to clarify this.