diff --git a/src/index.tsx b/src/index.tsx index e79715f..28d78d9 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -9,8 +9,8 @@ if (import.meta.env.DEV && !(root instanceof HTMLElement)) { ); } -// polyfill umami track function for development -if (import.meta.env.DEV && !("umami" in window)) { +// polyfill umami track function for cases where it may not be able to get loaded and development +if (!("umami" in window)) { // @ts-ignore window.umami = { // biome-ignore lint/suspicious/noEmptyBlockStatements: diff --git a/src/pages/home.tsx b/src/pages/home.tsx index 28de58c..41e899a 100644 --- a/src/pages/home.tsx +++ b/src/pages/home.tsx @@ -48,12 +48,13 @@ export const Home: Component = () => { decryptBackup(currentBackupFile, currentPassphrase, setDecryptionProgress, async (statements) => { const length = statements.length; setTotalStatements((oldValue) => oldValue + length); + const prevExecutedStatements = executedStatements(); await loadDb(statements, (progress) => { - setExecutedStatements((oldValue) => Math.round(oldValue + (progress / 100) * length)); + setExecutedStatements(Math.round(prevExecutedStatements + (progress / 100) * length)); }); - setExecutedStatements((oldValue) => oldValue + length); + setExecutedStatements(prevExecutedStatements + length); }) .then(() => { umami.track("Decrypt backup");