From 1d2d46e7991f79562ae051a68669881cc9b4237f Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 8 Dec 2017 14:59:43 +0900 Subject: [PATCH] RE: Fix #952 --- src/web/app/boot.js | 4 ++++ src/web/app/common/scripts/check-for-update.ts | 4 ++++ src/web/assets/404.js | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/src/web/app/boot.js b/src/web/app/boot.js index 0a3154ad88..211dc2f883 100644 --- a/src/web/app/boot.js +++ b/src/web/app/boot.js @@ -95,6 +95,10 @@ // Clear cache (serive worker) try { navigator.serviceWorker.controller.postMessage('clear'); + + navigator.serviceWorker.getRegistrations().then(registrations => { + registrations.forEach(registration => registration.unregister()); + }); } catch (e) { console.error(e); } diff --git a/src/web/app/common/scripts/check-for-update.ts b/src/web/app/common/scripts/check-for-update.ts index 1540924510..0b58c0a674 100644 --- a/src/web/app/common/scripts/check-for-update.ts +++ b/src/web/app/common/scripts/check-for-update.ts @@ -11,6 +11,10 @@ export default async function(mios: MiOS) { // Clear cache (serive worker) try { navigator.serviceWorker.controller.postMessage('clear'); + + navigator.serviceWorker.getRegistrations().then(registrations => { + registrations.forEach(registration => registration.unregister()); + }); } catch (e) { console.error(e); } diff --git a/src/web/assets/404.js b/src/web/assets/404.js index 46fd004f14..285704d113 100644 --- a/src/web/assets/404.js +++ b/src/web/assets/404.js @@ -5,6 +5,10 @@ if (yn) { // Clear cache (serive worker) try { navigator.serviceWorker.controller.postMessage('clear'); + + navigator.serviceWorker.getRegistrations().then(registrations => { + registrations.forEach(registration => registration.unregister()); + }); } catch (e) { console.error(e); }