Plugin Studio releases its corner-widget hosts when it unmounts

window.__doxaStudioWidgets keeps the corner hosts across a hot update so a live widget keeps its
state, but a real unmount never released it, so the hosts and every widget element in them stayed
on the page. It is now released in beforeUnmount, except during a hot update.
This commit is contained in:
Doxa Maps 2026-09-28 19:51:37 +00:00
parent 1fb2ea9a25
commit 9924e056b5

View file

@ -758,6 +758,15 @@ export default defineComponent({
}
this.loadManifest()
},
// The corner-widget hosts live on window.__doxaStudioWidgets so a HOT UPDATE remounts Studio onto
// the same hosts and a live widget (Rudder) keeps its state. A real unmount must release them, or
// the hosts and every widget element in them stay pinned on the page after Studio is gone.
beforeUnmount() {
if (import.meta.hot) return
const W = window.__doxaStudioWidgets
if (W && W.hosts) for (const h of Object.values(W.hosts)) { try { h.remove() } catch (_) {} }
delete window.__doxaStudioWidgets
},
methods: {
// ── MAP TOKEN ────────────────────────────────────────────────────────────────────────────────
// A token service answers with JSON ({token|tk|accessToken}) or a bare string — the same contract