mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Try to force refresh if old service worker is used (#21561)
* Try to force refresh if old service worker is used * Update register-service-worker.ts
This commit is contained in:
parent
a9310fdde0
commit
33931b29a1
@ -23,6 +23,13 @@ export const registerServiceWorker = async (
|
||||
return;
|
||||
}
|
||||
|
||||
if (reg?.active?.scriptURL.includes("service_worker.js")) {
|
||||
// We are running an old version of the service worker. Force reload.
|
||||
await reg.unregister();
|
||||
// @ts-ignore Firefox supports force reload
|
||||
location.reload(true);
|
||||
}
|
||||
|
||||
reg.addEventListener("updatefound", () => {
|
||||
const installingWorker = reg.installing;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user