From 61213d240c8931b5636bbfb739fcd7f3fa74cda8 Mon Sep 17 00:00:00 2001 From: Matt Hillsdon Date: Wed, 29 May 2024 13:58:11 +0100 Subject: [PATCH] Clean up if the PWA flag is disabled --- src/index.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/index.tsx b/src/index.tsx index 4afd1f87e..b5a372ef7 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -49,6 +49,15 @@ if (flags.pwa) { } }, }); +} else { + // Clean up if we've disabled the flag + if ("serviceWorker" in navigator) { + navigator.serviceWorker.getRegistration().then((registration) => { + registration?.unregister().then(() => { + window.location.reload(); + }); + }); + } } const root = createRoot(document.getElementById("root")!);