aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.js')
-rw-r--r--src/app.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/app.js b/src/app.js
index 8908258..56ab639 100644
--- a/src/app.js
+++ b/src/app.js
@@ -17,6 +17,7 @@ import { scanQr } from './scan.js';
import { dataSources, getSource, setSource, getNetwork, setNetwork, NETWORKS } from './api.js';
import { STAGING } from './build-flags.js';
import { buildFeatures, loadDeferredFeatures } from './features/index.js';
+import { cacheReady, cacheStore } from './cache-store.js';
import { t, LANGS, getLang, setLang, isRTL, loadLocale } from './i18n.js';
import { rateNow, rateAt, refreshRates, haveRate, getCurrency, setCurrency, currencies, fmtFiat, fmtFiatBare } from './rates.js';
import {
@@ -2372,6 +2373,7 @@ function wipeAccountCache(acc) {
for (let i = 0; i < localStorage.length; i++) { const k = localStorage.key(i); if (k && bases.some((b) => k.startsWith(b))) keys.push(k); }
keys.forEach((k) => localStorage.removeItem(k));
} catch {}
+ for (const b of bases) { try { cacheStore().removePrefix(b); } catch {} }
for (const f of FEATURES) { try { f.wipeCache && f.wipeCache(bases); } catch {} }
}
@@ -6172,7 +6174,12 @@ loadLocale(getLang()).finally(async () => {
refreshRates().then(() => { if (unit === 'fiat') render(); }).catch(() => {});
setInterval(() => { refreshRates().then(() => { if (unit === 'fiat') render(); }).catch(() => {}); }, 10 * 60_000);
const storeReady = featureHook('arkStoreReady');
- if (storeReady) await storeReady;
+ // the IndexedDB caches (profiles, reports, …) open alongside: a wallet's
+ // caches are read as soon as it opens
+ await Promise.all([storeReady, cacheReady()].filter(Boolean)).catch(() => {});
+ // Ask the browser not to evict this site's storage under disk pressure.
+ // Chrome answers without a prompt (yes for an installed or busy site).
+ try { navigator.storage?.persist?.().catch(() => {}); } catch {}
_bootDeciding = false; // from here on the screen is a decision, not a guess
const opened = restoreAccountsState();
if (!opened) render();