From b05e2d3c552508eedf5cf1cb9f015482aa32280b Mon Sep 17 00:00:00 2001 From: Fabian Date: Tue, 2 Jul 2019 20:02:47 +0200 Subject: [PATCH] Fixing ServiceWorker Clear Cache --- public/serviceworker.js | 17 +++-------------- src/components/routes/settings/Settings.tsx | 2 +- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/public/serviceworker.js b/public/serviceworker.js index 0671772..fe23543 100644 --- a/public/serviceworker.js +++ b/public/serviceworker.js @@ -27,20 +27,9 @@ self.addEventListener('activate', (event) => { }); self.addEventListener('message', (event) => { - if (event.data === "clear_cache") { - log("Clearing cache"); - caches.delete(CACHE); - event.waitUntil(precache()); - } - - if (event.data === "update_index") { - log("Updating index"); - event.waitUntil(caches.open(CACHE).then((cache) => { - return cache.addAll(["/", "/index.html"]).then(() => { - event.ports[0].postMessage("reload"); - }); - })) - } + log("Clearing cache"); + caches.delete(CACHE); + event.waitUntil(precache()); }); var Types; diff --git a/src/components/routes/settings/Settings.tsx b/src/components/routes/settings/Settings.tsx index f0d41b6..caf00a4 100644 --- a/src/components/routes/settings/Settings.tsx +++ b/src/components/routes/settings/Settings.tsx @@ -30,7 +30,7 @@ export default class SettingsPage extends Page<{ state: any }, { vault: string } {/* */} - + ; }