From 857a2b9dcaf64d4298027644f8e6716fa22db941 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 11 May 2020 21:47:35 +0530 Subject: perf: reserve history in separate object store --- src/webex/pages/popup.tsx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/webex') diff --git a/src/webex/pages/popup.tsx b/src/webex/pages/popup.tsx index 450aae4ce..4d3c65b26 100644 --- a/src/webex/pages/popup.tsx +++ b/src/webex/pages/popup.tsx @@ -177,6 +177,7 @@ class WalletBalanceView extends React.Component { private gotError = false; private canceler: (() => void) | undefined = undefined; private unmount = false; + private updateBalanceRunning = false; componentWillMount(): void { this.canceler = wxApi.onUpdateNotification(() => this.updateBalance()); @@ -192,6 +193,10 @@ class WalletBalanceView extends React.Component { } async updateBalance(): Promise { + if (this.updateBalanceRunning) { + return; + } + this.updateBalanceRunning = true; let balance: WalletBalance; try { balance = await wxApi.getBalance(); @@ -203,6 +208,8 @@ class WalletBalanceView extends React.Component { console.error("could not retrieve balances", e); this.setState({}); return; + } finally { + this.updateBalanceRunning = false; } if (this.unmount) { return; -- cgit v1.2.3