fix: wrong database loading progress display
This commit is contained in:
parent
7a5b3492e7
commit
7e36425d6a
2 changed files with 5 additions and 4 deletions
|
@ -9,8 +9,8 @@ if (import.meta.env.DEV && !(root instanceof HTMLElement)) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// polyfill umami track function for development
|
// polyfill umami track function for cases where it may not be able to get loaded and development
|
||||||
if (import.meta.env.DEV && !("umami" in window)) {
|
if (!("umami" in window)) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
window.umami = {
|
window.umami = {
|
||||||
// biome-ignore lint/suspicious/noEmptyBlockStatements: <explanation>
|
// biome-ignore lint/suspicious/noEmptyBlockStatements: <explanation>
|
||||||
|
|
|
@ -48,12 +48,13 @@ export const Home: Component<RouteSectionProps> = () => {
|
||||||
decryptBackup(currentBackupFile, currentPassphrase, setDecryptionProgress, async (statements) => {
|
decryptBackup(currentBackupFile, currentPassphrase, setDecryptionProgress, async (statements) => {
|
||||||
const length = statements.length;
|
const length = statements.length;
|
||||||
setTotalStatements((oldValue) => oldValue + length);
|
setTotalStatements((oldValue) => oldValue + length);
|
||||||
|
const prevExecutedStatements = executedStatements();
|
||||||
|
|
||||||
await loadDb(statements, (progress) => {
|
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(() => {
|
.then(() => {
|
||||||
umami.track("Decrypt backup");
|
umami.track("Decrypt backup");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue