AlertStore: run scheduled close in action

This commit is contained in:
Jesse Chan
2020-11-15 16:10:49 +08:00
parent 8fa5efbbfc
commit cd32716a06
+4 -2
View File
@@ -1,4 +1,4 @@
import {computed, extendObservable, makeAutoObservable} from 'mobx';
import {computed, extendObservable, makeAutoObservable, runInAction} from 'mobx';
import sort from 'fast-sort';
export interface Alert {
@@ -48,7 +48,9 @@ class AlertStore {
scheduleClose(id: string, duration = DEFAULT_DURATION): number {
return window.setTimeout(() => {
delete this.alerts[id];
runInAction(() => {
delete this.alerts[id];
});
}, duration);
}
}