aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-11-13 07:55:42 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-11-13 09:06:14 +0800
commit7b50a6490db820b4e7f7b972ae0dcb602e5118b6 (patch)
tree62ae0c172b5dfa26810b19ca51b0594850e838bb /src
parentfdb82d5dd4ea14e35ee03cf9abca6105fa1e0595 (diff)
downloaddexon-sol-tools-7b50a6490db820b4e7f7b972ae0dcb602e5118b6.tar
dexon-sol-tools-7b50a6490db820b4e7f7b972ae0dcb602e5118b6.tar.gz
dexon-sol-tools-7b50a6490db820b4e7f7b972ae0dcb602e5118b6.tar.bz2
dexon-sol-tools-7b50a6490db820b4e7f7b972ae0dcb602e5118b6.tar.lz
dexon-sol-tools-7b50a6490db820b4e7f7b972ae0dcb602e5118b6.tar.xz
dexon-sol-tools-7b50a6490db820b4e7f7b972ae0dcb602e5118b6.tar.zst
dexon-sol-tools-7b50a6490db820b4e7f7b972ae0dcb602e5118b6.zip
Don't store empty objects
Diffstat (limited to 'src')
-rw-r--r--src/stores/balance_proxy_allowance_lazy_store.ts6
1 files changed, 6 insertions, 0 deletions
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<BigNumber> {
@@ -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 {