sw: Remove fetch handler from service worker
Some checks failed
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful
ci/woodpecker/pr/lint-backend Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/test Pipeline failed

In current state, service worker overloads every "connection error"
kind of reaction to a plaintext 200 saying "Offline.", which leads
to terribly undebuggable situations as the browser decides to cache
this as an image, and then someone's pfp is broken literally
forever unless you Ctrl+Shift+R every time you reload frontend.

This change removes the handler, because it is unclear how we even
benefit from it being there.
This commit is contained in:
Michcio 2022-09-06 23:24:23 +02:00
parent 5a9d4a3759
commit 026941ce77

View file

@ -23,13 +23,6 @@ self.addEventListener('activate', ev => {
);
});
self.addEventListener('fetch', ev => {
ev.respondWith(
fetch(ev.request)
.catch(() => new Response(`Offline. Service Worker @${_VERSION_}`, { status: 200 }))
);
});
self.addEventListener('push', ev => {
// クライアント取得
ev.waitUntil(self.clients.matchAll({