You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
shouldn't @action make notifications be executed after the method?
here says https://pub.dev/packages/mobx#actions : Besides, actions also batch up all the notifications and ensure the changes are notified only after they complete. Thus the observers are notified only upon the atomic completion of the action.
@observableint a =0;
@actioninit() async {
awaitFuture.delayed(Duration.zero);
a =awaitFuture.delayed(Duration(seconds:1), () {
return1;
});
awaitFuture.delayed(Duration.zero);
a =awaitFuture.delayed(Duration(seconds:1), () {
return2;
});
awaitFuture.delayed(Duration.zero);
a =awaitFuture.delayed(Duration(seconds:1), () {
return3;
});
awaitFuture.delayed(Duration.zero);
}
if the code has a 'await' the Observer is called even if the @action method is not finished, in this case the Observer is called 3 times after the "await Future.delayed(Duration.zero);"
Discussed in #789
Originally posted by danteCarvalho April 6, 2022
shouldn't @action make notifications be executed after the method?
here says https://pub.dev/packages/mobx#actions :
Besides, actions also batch up all the notifications and ensure the changes are notified only after they complete. Thus the observers are notified only upon the atomic completion of the action.
if the code has a 'await' the Observer is called even if the @action method is not finished, in this case the Observer is called 3 times after the "await Future.delayed(Duration.zero);"
testef.zip
The text was updated successfully, but these errors were encountered: