Skip to content

Commit

Permalink
wrap in runInAction
Browse files Browse the repository at this point in the history
  • Loading branch information
yushih committed Apr 28, 2022
1 parent 15a0a77 commit 14263cf
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions packages/yoroi-extension/app/stores/toplevel/WalletSettingsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,12 @@ export default class WalletSettingsStore extends Store<StoresMap, ActionsMap> {

const promise = this.api[apiType].removeAllTransactions(req);

this.stores.transactions.ongoingRefreshing.set(
req.publicDeriverId,
promise,
);

runInAction(() => {
this.stores.transactions.ongoingRefreshing.set(
req.publicDeriverId,
promise,
);
});
return promise;
});

Expand Down Expand Up @@ -232,9 +233,11 @@ export default class WalletSettingsStore extends Store<StoresMap, ActionsMap> {
}
// currently in the map the promise for this wallet is this resyncing process,
// we need to remove it before calling refreshing otherwise it's a deadlock
this.stores.transactions.ongoingRefreshing.delete(
request.publicDeriver.publicDeriverId,
);
runInAction(() => {
this.stores.transactions.ongoingRefreshing.delete(
request.publicDeriver.publicDeriverId,
);
});
// refresh
return this.stores.wallets.refreshWalletFromRemote(request.publicDeriver);
}
Expand All @@ -243,9 +246,11 @@ export default class WalletSettingsStore extends Store<StoresMap, ActionsMap> {
// if everything runs without any error, the promise should have already
// been removed, but here make sure it is, so that future refreshing
// is not affected
this.stores.transactions.ongoingRefreshing.delete(
request.publicDeriver.publicDeriverId,
);
runInAction(() => {
this.stores.transactions.ongoingRefreshing.delete(
request.publicDeriver.publicDeriverId,
);
});
}

this.stores.transactions.clearSubmittedTransactions(request.publicDeriver);
Expand Down

0 comments on commit 14263cf

Please sign in to comment.