From 8d05414ecde19515d0c01e1745a9d55a76a25f51 Mon Sep 17 00:00:00 2001 From: Matt Hillsdon Date: Wed, 29 May 2024 14:10:39 +0100 Subject: [PATCH] Change the SW clean-up We can just remove the SW for our scope. --- src/simulator.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/simulator.ts b/src/simulator.ts index 7b12913..7410722 100644 --- a/src/simulator.ts +++ b/src/simulator.ts @@ -47,13 +47,10 @@ if ("serviceWorker" in navigator) { if (flags.sw) { initServiceWorker(); } else { - navigator.serviceWorker.getRegistrations().then((registrations) => { - if (registrations.length > 0) { - // We should only have one service worker to unregister. - registrations[0].unregister().then(() => { - window.location.reload(); - }); - } + navigator.serviceWorker.getRegistration().then((registration) => { + registration?.unregister().then(() => { + window.location.reload(); + }); }); } }