aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-08-19 21:23:31 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2022-08-20 21:41:50 +0200
commitbeda5138e018d9a853d57bd7274a35c21fa5c366 (patch)
tree3f6ff98c917db824a850c85eee7fbd76021adc27 /subprojects/frontend/src
parentfeat(frontend): add PWA manifest (diff)
downloadrefinery-beda5138e018d9a853d57bd7274a35c21fa5c366.tar.gz
refinery-beda5138e018d9a853d57bd7274a35c21fa5c366.tar.zst
refinery-beda5138e018d9a853d57bd7274a35c21fa5c366.zip
fix(frontend): destroy service worker in dev mode
If the application is run in both production and development mode on the same domain, make sure to clean up the production service worker.
Diffstat (limited to 'subprojects/frontend/src')
-rw-r--r--subprojects/frontend/src/RegisterServiceWorker.tsx3
1 files changed, 2 insertions, 1 deletions
diff --git a/subprojects/frontend/src/RegisterServiceWorker.tsx b/subprojects/frontend/src/RegisterServiceWorker.tsx
index c9b2e353..5f46bc3d 100644
--- a/subprojects/frontend/src/RegisterServiceWorker.tsx
+++ b/subprojects/frontend/src/RegisterServiceWorker.tsx
@@ -50,7 +50,8 @@ function UpdateSnackbarActions({
50export default function RegisterServiceWorker(): null { 50export default function RegisterServiceWorker(): null {
51 const { enqueueSnackbar, closeSnackbar } = useSnackbar(); 51 const { enqueueSnackbar, closeSnackbar } = useSnackbar();
52 useEffect(() => { 52 useEffect(() => {
53 if (import.meta.env.DEV) { 53 if (window.location.host === 'localhost') {
54 // Do not register service worker during local development.
54 return; 55 return;
55 } 56 }
56 if (!('serviceWorker' in navigator)) { 57 if (!('serviceWorker' in navigator)) {