From e960876188036f0006c0fdc91e969ff86ad48b36 Mon Sep 17 00:00:00 2001 From: marc2332 Date: Fri, 17 May 2024 10:32:19 +0200 Subject: [PATCH 1/3] fix: Handle empty network name --- packages/desktop/components/WalletSummary.svelte | 6 +++--- .../active-profile/checkAndUpdateActiveProfileNetwork.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/desktop/components/WalletSummary.svelte b/packages/desktop/components/WalletSummary.svelte index 6c414d2756b..16bf8d04574 100644 --- a/packages/desktop/components/WalletSummary.svelte +++ b/packages/desktop/components/WalletSummary.svelte @@ -8,10 +8,10 @@ import { selectedWalletAssets } from '@core/wallet' import { activeProfile } from '@core/profile' - $: fomattedNetworkName = $nodeInfoNetworkName - .split(' ') + $: fomattedNetworkName = $nodeInfoNetworkName ? + $nodeInfoNetworkName.split(' ') .map((word) => word[0].toUpperCase() + word.substring(1)) - .join(' ') + .join(' ') : '' $: ({ baseCoin, mana } = $selectedWalletAssets[$activeProfile?.network.id]) diff --git a/packages/shared/lib/core/profile/actions/active-profile/checkAndUpdateActiveProfileNetwork.ts b/packages/shared/lib/core/profile/actions/active-profile/checkAndUpdateActiveProfileNetwork.ts index 3bfcec10170..62af9184d80 100644 --- a/packages/shared/lib/core/profile/actions/active-profile/checkAndUpdateActiveProfileNetwork.ts +++ b/packages/shared/lib/core/profile/actions/active-profile/checkAndUpdateActiveProfileNetwork.ts @@ -6,6 +6,7 @@ import { get } from 'svelte/store' export async function checkAndUpdateActiveProfileNetwork(): Promise { const $activeProfile = get(activeProfile) const nodeInfoResponse = await getAndUpdateNodeInfo(true) + console.log(nodeInfoResponse) const networkId = $activeProfile?.network?.id const networkName = nodeInfoResponse?.nodeInfo?.protocolParameters[0]?.parameters?.networkName if (!networkId || networkId === NetworkId.Custom) { From e94eb386a7a004b044b0ce10ea57240323e5b1ad Mon Sep 17 00:00:00 2001 From: marc2332 Date: Fri, 17 May 2024 10:33:18 +0200 Subject: [PATCH 2/3] cleanup --- .../actions/active-profile/checkAndUpdateActiveProfileNetwork.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/shared/lib/core/profile/actions/active-profile/checkAndUpdateActiveProfileNetwork.ts b/packages/shared/lib/core/profile/actions/active-profile/checkAndUpdateActiveProfileNetwork.ts index 62af9184d80..3bfcec10170 100644 --- a/packages/shared/lib/core/profile/actions/active-profile/checkAndUpdateActiveProfileNetwork.ts +++ b/packages/shared/lib/core/profile/actions/active-profile/checkAndUpdateActiveProfileNetwork.ts @@ -6,7 +6,6 @@ import { get } from 'svelte/store' export async function checkAndUpdateActiveProfileNetwork(): Promise { const $activeProfile = get(activeProfile) const nodeInfoResponse = await getAndUpdateNodeInfo(true) - console.log(nodeInfoResponse) const networkId = $activeProfile?.network?.id const networkName = nodeInfoResponse?.nodeInfo?.protocolParameters[0]?.parameters?.networkName if (!networkId || networkId === NetworkId.Custom) { From 607121bd46e99dc9d2075bbe946d59e86eb89446 Mon Sep 17 00:00:00 2001 From: marc2332 Date: Fri, 17 May 2024 10:35:17 +0200 Subject: [PATCH 3/3] fmt --- packages/desktop/components/WalletSummary.svelte | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/desktop/components/WalletSummary.svelte b/packages/desktop/components/WalletSummary.svelte index 16bf8d04574..88c7698a9db 100644 --- a/packages/desktop/components/WalletSummary.svelte +++ b/packages/desktop/components/WalletSummary.svelte @@ -8,10 +8,12 @@ import { selectedWalletAssets } from '@core/wallet' import { activeProfile } from '@core/profile' - $: fomattedNetworkName = $nodeInfoNetworkName ? - $nodeInfoNetworkName.split(' ') - .map((word) => word[0].toUpperCase() + word.substring(1)) - .join(' ') : '' + $: fomattedNetworkName = $nodeInfoNetworkName + ? $nodeInfoNetworkName + .split(' ') + .map((word) => word[0].toUpperCase() + word.substring(1)) + .join(' ') + : '' $: ({ baseCoin, mana } = $selectedWalletAssets[$activeProfile?.network.id])