Skip to content

Commit

Permalink
A few more attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
adamziel committed Jun 17, 2023
1 parent 746f215 commit 8b119f5
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/php-wasm/web/src/lib/register-service-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,20 @@ export async function registerServiceWorker<
`(expected version: ${expectedVersion}, registered version: ${actualVersion})`
);
for (const registration of registrations) {
registration.unregister();
try {
await registration.update();
} catch(e) {
console.warn(`[window] Failed to update the Service Worker registration:`, e);
await registration.unregister();
const waitingWorker =
registration.waiting || registration.installing;
waitingWorker?.postMessage('skip-waiting');
} catch (e) {
console.warn(
`[window] Failed to update the Service Worker registration:`,
e
);
}
}
window.location.reload();
console.log(' Window location reload...? ');
window.parent.location.reload();
}
} else {
console.debug(
Expand Down

0 comments on commit 8b119f5

Please sign in to comment.