mobx-utils: invalid 'actionAsync' context when promises resolve at the same time in different actionAsync
Im getting the following error when i run the code below
mobx-utils.module.js:6 Uncaught (in promise) Error: [mobx-utils] invalid 'actionAsync' context when finishing action 'actionAsync1'. an action context for 'actionAsync2' was found instead. did you await inside an 'actionAsync' without using 'task(promise)'? did you forget to await the task?
const r = new Promise(resolve => {
setTimeout(() => {
resolve(null);
}, 1000);
});
const actionAsync1 = actionAsync("actionAsync1", async () => {
await task(r);
});
const actionAsync2 = actionAsync("actionAsync2", async () => {
await task(r);
});
actionAsync1();
actionAsync2();
It happens with both the following version combinations:
"mobx": "4.15.4",
"mobx-utils": "5.5.3",
"mobx": "5.15.4",
"mobx-utils": "5.5.3",
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 15 (9 by maintainers)
v5.5.6
Thanks, just made a PR that should solve this
Should be out now as 5.5.4