-
Hello everyone! I need some help. I've read the https://mobx.js.org/actions.html#asynchronous-actions page, but it does not show a similar case like mine. What is happening? Why is this a problem? What is the ideal solution? const obj = {
asyncAction = mobx.action(async () => {
await functionThatChangesStateAfterResult();
await anotherFunctionThatChangesStateAfterResult();
});
} After looking at the MobX internals I see that Thank you for your time! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
There is nothing like async transaction. Create a local temporal object/variable that is modified by the individual async tasks and write the result to actual observables at the end of async flow. |
Beta Was this translation helpful? Give feedback.
-
Or capture the writes in a thunk to postpone them and run them at the end.
…On Wed, 13 Oct 2021, 19:09 urugator, ***@***.***> wrote:
There is nothing like async transaction. Create a local temporal object
that is modified by the individual async tasks and write the result to
actual observables at the end of async flow.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3144 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBC4NYQP2ZEIGDNABHDUGXDL5ANCNFSM5F5EC27A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Beta Was this translation helpful? Give feedback.
There is nothing like async transaction. Create a local temporal object/variable that is modified by the individual async tasks and write the result to actual observables at the end of async flow.