refactor(fix-sw): single RELOAD_DELAY_S constant, set to 11s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,8 @@ import { RefreshCw } from '@lucide/svelte';
|
|||||||
let status: string[] = $state([]);
|
let status: string[] = $state([]);
|
||||||
let done = $state(false);
|
let done = $state(false);
|
||||||
let has_error = $state(false);
|
let has_error = $state(false);
|
||||||
let countdown = $state(7);
|
const RELOAD_DELAY_S = 11;
|
||||||
|
let countdown = $state(RELOAD_DELAY_S);
|
||||||
const origin = typeof window !== 'undefined' ? window.location.origin : '';
|
const origin = typeof window !== 'undefined' ? window.location.origin : '';
|
||||||
|
|
||||||
function log(msg: string) {
|
function log(msg: string) {
|
||||||
@@ -130,7 +131,7 @@ async function nuke_everything() {
|
|||||||
log(`ERROR clearing sessionStorage: ${err.message}`);
|
log(`ERROR clearing sessionStorage: ${err.message}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
log('─── Reset complete. Reloading in 7 seconds... ───');
|
log(`─── Reset complete. Reloading in ${RELOAD_DELAY_S} seconds... ───`);
|
||||||
done = true;
|
done = true;
|
||||||
|
|
||||||
const tick = setInterval(() => {
|
const tick = setInterval(() => {
|
||||||
@@ -138,7 +139,7 @@ async function nuke_everything() {
|
|||||||
if (countdown <= 0) clearInterval(tick);
|
if (countdown <= 0) clearInterval(tick);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
await new Promise((r) => setTimeout(r, 7000));
|
await new Promise((r) => setTimeout(r, RELOAD_DELAY_S * 1000));
|
||||||
window.location.href = '/';
|
window.location.href = '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user