From 8c6b0003bca1fcccecbfc108b6a6499191815315 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 6 May 2021 18:03:34 +0200 Subject: [PATCH] Remove setCatchHandler Signed-off-by: Thomas Citharel --- js/src/service-worker.ts | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/js/src/service-worker.ts b/js/src/service-worker.ts index 4a832b06d..ea958ccbe 100644 --- a/js/src/service-worker.ts +++ b/js/src/service-worker.ts @@ -1,4 +1,4 @@ -import { registerRoute, setCatchHandler } from "workbox-routing"; +import { registerRoute } from "workbox-routing"; import { NetworkFirst, StaleWhileRevalidate, @@ -10,7 +10,7 @@ import { CacheableResponsePlugin } from "workbox-cacheable-response"; // Used to limit entries in cache, remove entries after a certain period of time import { ExpirationPlugin } from "workbox-expiration"; -import { precacheAndRoute, matchPrecache } from "workbox-precaching"; +import { precacheAndRoute } from "workbox-precaching"; // Use with precache injection // eslint-disable-next-line @typescript-eslint/ban-ts-comment @@ -18,18 +18,6 @@ import { precacheAndRoute, matchPrecache } from "workbox-precaching"; // eslint-disable-next-line no-underscore-dangle precacheAndRoute(self.__WB_MANIFEST); -// Catch routing errors, like if the user is offline -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore -setCatchHandler(async ({ event }) => { - // Return the precached offline page if a document is being requested - if (event.request.destination === "document") { - return matchPrecache("/offline.html"); - } - - return Response.error(); -}); - registerRoute( // Check to see if the request is a navigation to a new page ({ request }) => request.mode === "navigate",