aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/sw.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/sw.js')
-rw-r--r--public/sw.js13
1 files changed, 5 insertions, 8 deletions
diff --git a/public/sw.js b/public/sw.js
index 99af941..571f752 100644
--- a/public/sw.js
+++ b/public/sw.js
@@ -1,6 +1,7 @@
-const CACHE = "kodaira-parks-v1";
+// 公園ページはドラフト公開停止中のため、公園ページをAPP_SHELLから外し、
+// キャッシュを v2 に更新して旧キャッシュを削除する。公開時に元に戻す。
+const CACHE = "kodaira-parks-v2";
const APP_SHELL = [
- "/kodaira-data/parks/",
"/manifest.webmanifest",
"/icons/icon-192.png",
"/icons/icon-512.png",
@@ -34,7 +35,7 @@ self.addEventListener("fetch", (event) => {
// OSMのタイルなど外部オリジンのものはキャッシュしない。
if (url.origin !== self.location.origin) return;
- // ページ遷移はネットワーク優先。オフライン時はキャッシュ→公園ページ。
+ // ページ遷移はネットワーク優先。オフライン時はキャッシュ。
if (request.mode === "navigate") {
event.respondWith(
fetch(request)
@@ -43,11 +44,7 @@ self.addEventListener("fetch", (event) => {
caches.open(CACHE).then((cache) => cache.put(request, copy));
return response;
})
- .catch(() =>
- caches
- .match(request)
- .then((cached) => cached || caches.match("/kodaira-data/parks/")),
- ),
+ .catch(() => caches.match(request)),
);
return;
}