From 7b50a6490db820b4e7f7b972ae0dcb602e5118b6 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Sun, 12 Nov 2017 18:55:42 -0500 Subject: Don't store empty objects --- src/stores/balance_proxy_allowance_lazy_store.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/stores/balance_proxy_allowance_lazy_store.ts b/src/stores/balance_proxy_allowance_lazy_store.ts index 5c54fbb3b..c83e61606 100644 --- a/src/stores/balance_proxy_allowance_lazy_store.ts +++ b/src/stores/balance_proxy_allowance_lazy_store.ts @@ -44,6 +44,9 @@ export class BalanceAndProxyAllowanceLazyStore { public deleteBalance(tokenAddress: string, userAddress: string): void { if (!_.isUndefined(this.balance[tokenAddress])) { delete this.balance[tokenAddress][userAddress]; + if (_.isEmpty(this.balance[tokenAddress])) { + delete this.balance[tokenAddress]; + } } } public async getProxyAllowanceAsync(tokenAddress: string, userAddress: string): Promise { @@ -67,6 +70,9 @@ export class BalanceAndProxyAllowanceLazyStore { public deleteProxyAllowance(tokenAddress: string, userAddress: string): void { if (!_.isUndefined(this.proxyAllowance[tokenAddress])) { delete this.proxyAllowance[tokenAddress][userAddress]; + if (_.isEmpty(this.proxyAllowance[tokenAddress])) { + delete this.proxyAllowance[tokenAddress]; + } } } public deleteAll(): void { -- cgit