diff --git a/src/serviceWorker.tsx b/src/serviceWorker.tsx index 1ef7271a..1784c8aa 100644 --- a/src/serviceWorker.tsx +++ b/src/serviceWorker.tsx @@ -37,6 +37,13 @@ export const register = (config?: Config) => { } window.addEventListener("load", () => { + const isWebexLP = window.location.pathname.startsWith("/webex"); + if (isWebexLP) { + unregister(() => { + window.location.reload(); + }); + return false; + } const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; if (isLocalhost) { @@ -135,11 +142,14 @@ const checkValidServiceWorker = (swUrl: string, config?: Config) => { }); }; -export const unregister = () => { +export const unregister = (callback?: () => void) => { if ("serviceWorker" in navigator) { navigator.serviceWorker.ready .then((registration) => { - registration.unregister(); + return registration.unregister(); + }) + .then(() => { + callback?.(); }) .catch((error) => { console.error(error.message); diff --git a/vercel.json b/vercel.json index e9507373..75a3de25 100644 --- a/vercel.json +++ b/vercel.json @@ -22,5 +22,11 @@ } ] } + ], + "rewrites": [ + { + "source": "/webex/:match*", + "destination": "https://excalidraw-webex-lp.vercel.app/:match*" + } ] }