Resume offline preparation on launch and show cache readiness

This commit is contained in:
Jonathan Sykes
2026-10-09 09:33:23 +08:00
parent 0251720fa2
commit 009a155568
6 changed files with 63 additions and 8 deletions

View File

@@ -8690,11 +8690,11 @@ async function applyUpdate(target, { quiet = false } = {}) {
// When the waiting worker already downloaded this build in the
// background, the toast says so and nothing is re-downloaded.
askStatus: (worker) => SU.askCacheStatus(worker, { timeoutMs: 4000, setTimeout: (fn, ms) => setTimeout(fn, ms) }),
onPhase: (phase) => {
onPhase: (phase, status) => {
if (quiet) return;
if (_updateToast) _updateToast.remove();
_updateToast = phase === 'ready'
? toast('Applying the update…', { duration: 20000 })
? toast(status?.offlineReady === false ? `Applying the update… Offline cache is still preparing (${status.cached}/${status.total}).` : 'Applying the update…', { duration: 20000 })
: toast('Downloading the update…', { duration: 305000 });
},
refreshShell: ('caches' in window) ? () => SU.refreshShellInPlace({