How does @action actually work? #884
-
I have used MobX for years. Today I read the document again, the action session: https://mobx.netlify.app/api/action I think I am confused about how the action works to "batch" observables.
In my stores, I often change the observables, each time the observables are changed/mutated, the UI gets notified immediately.
On the UI, I can see the update when loading = true and then (after some seconds for fetching data) UI is updated one more time when loading = false. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@thphuc You can take a look at my PR #841, it also has some related information about this issue. It's completely an issue that needs to be fixed. |
Beta Was this translation helpful? Give feedback.
-
According to the docs, that behavior is intended. mobxjs/mobx#3144
https://mobx.js.org/actions.html#asynchronous-actions |
Beta Was this translation helpful? Give feedback.
@thphuc
According to the docs, that behavior is intended.
mobxjs/mobx#3144
mobxjs/mobx#3144 (comment)