From 4bd2d7fbfdc86c6c5fcc15923955ce148e9140e4 Mon Sep 17 00:00:00 2001 From: n9lsjr Date: Tue, 13 Feb 2024 17:25:33 +0100 Subject: [PATCH] Set stored balance in localStorage to avoid showing zero balance while loading on start --- src/lib/stores/wallet.js | 3 ++- src/routes/auth/create-wallet/+page.svelte | 2 ++ src/routes/auth/login-wallet/+page.svelte | 7 ++++++- src/routes/wallet/+layout.svelte | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/lib/stores/wallet.js b/src/lib/stores/wallet.js index 1de358f..97233cb 100644 --- a/src/lib/stores/wallet.js +++ b/src/lib/stores/wallet.js @@ -7,7 +7,8 @@ export const wallet = writable({ addresses: [], preparedTransaction: undefined, file: false, - path: false + path: false, + started: false }) export const transactions = writable({ diff --git a/src/routes/auth/create-wallet/+page.svelte b/src/routes/auth/create-wallet/+page.svelte index 5b8553c..eb2ab48 100644 --- a/src/routes/auth/create-wallet/+page.svelte +++ b/src/routes/auth/create-wallet/+page.svelte @@ -37,6 +37,8 @@ await goto('/auth/backup-wallet'); } } + + $wallet.started = true }; const openFromFile = () => { diff --git a/src/routes/auth/login-wallet/+page.svelte b/src/routes/auth/login-wallet/+page.svelte index 8aa2466..08b9b99 100644 --- a/src/routes/auth/login-wallet/+page.svelte +++ b/src/routes/auth/login-wallet/+page.svelte @@ -44,6 +44,9 @@ await goto('/wallet/dashboard'); password = ''; loading = false; + //Set stored balance to avoid showing zero balance while loading + $wallet.balance = [localStorage.getItem('balance'), 0] ?? [0, 0]; + $wallet.started = true; }); }); @@ -120,7 +123,9 @@

v1.0.0

{$wallet.currentWallet}.wallet

-

openFromFile()}>Open another wallet

+ {#if !$wallet.started} +

openFromFile()}>Open another wallet

+ {/if} {