From eabe4bd0560856484f5d854cec98634c33d40b42 Mon Sep 17 00:00:00 2001 From: Jorge Luis <28708889+hyphenized@users.noreply.github.com> Date: Tue, 25 Feb 2025 12:34:08 -0500 Subject: [PATCH] Fix excessive loading time on new accounts Fixes a case where a balance of zero would prevent loading from finishing early and, reduces initialLoad timer to 90 seconds. --- background/redux-slices/selectors/accountsSelectors.ts | 6 +++--- background/services/redux/index.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/background/redux-slices/selectors/accountsSelectors.ts b/background/redux-slices/selectors/accountsSelectors.ts index ec7cc9722..67b95dbc4 100644 --- a/background/redux-slices/selectors/accountsSelectors.ts +++ b/background/redux-slices/selectors/accountsSelectors.ts @@ -44,7 +44,7 @@ import { DOGGO } from "../../constants/assets" import { FeatureFlags, isEnabled } from "../../features" import { AccountSigner, SignerType } from "../../services/signing" import { SignerImportSource } from "../../services/internal-signer" -import { assertUnreachable } from "../../lib/utils/type-guards" +import { assertUnreachable, isDefined } from "../../lib/utils/type-guards" import { PricesState, selectAssetPricePoint } from "../prices" import { TESTNET_TAHO } from "../../services/island" @@ -264,7 +264,7 @@ export const selectAccountAndTimestampedActivities = createSelector( return { combinedData: { assets: combinedAssetAmounts, - totalMainCurrencyValue: totalMainCurrencyAmount + totalMainCurrencyValue: isDefined(totalMainCurrencyAmount) ? formatCurrencyAmount( mainCurrencySymbol, totalMainCurrencyAmount, @@ -317,7 +317,7 @@ export const selectCurrentAccountBalances = createSelector( allAssetAmounts, assetAmounts: combinedAssetAmounts, unverifiedAssetAmounts, - totalMainCurrencyValue: totalMainCurrencyAmount + totalMainCurrencyValue: isDefined(totalMainCurrencyAmount) ? formatCurrencyAmount( mainCurrencySymbol, totalMainCurrencyAmount, diff --git a/background/services/redux/index.ts b/background/services/redux/index.ts index abb6efaf5..919e3e9a7 100644 --- a/background/services/redux/index.ts +++ b/background/services/redux/index.ts @@ -376,7 +376,7 @@ export default class ReduxService extends BaseService { ) { super({ initialLoadWaitExpired: { - schedule: { delayInMinutes: 2.5 }, + schedule: { delayInMinutes: 1.5 }, handler: () => this.store.dispatch(initializationLoadingTimeHitLimit()), }, })