From db73918292c1d8022e9f7d809ca5e9c31a1ac64e Mon Sep 17 00:00:00 2001 From: Matt Hillsdon Date: Wed, 29 May 2024 13:59:39 +0100 Subject: [PATCH] We only want to unregister our scoped sw --- lib/micropython-microbit-v2 | 2 +- src/simulator.ts | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/micropython-microbit-v2 b/lib/micropython-microbit-v2 index 8aaa36b8..17aaa115 160000 --- a/lib/micropython-microbit-v2 +++ b/lib/micropython-microbit-v2 @@ -1 +1 @@ -Subproject commit 8aaa36b8d50211f5902d50e050632a88358d369f +Subproject commit 17aaa115ad4ad285377b2eb210f37b0e94f61aa9 diff --git a/src/simulator.ts b/src/simulator.ts index 7b129130..74107222 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(); + }); }); } }