Skip to content

Commit

Permalink
Clean up if the PWA flag is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-matt-hillsdon committed May 29, 2024
1 parent 369a982 commit 61213d2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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")!);
Expand Down

0 comments on commit 61213d2

Please sign in to comment.