A destroyed map's container stops holding it

containerRef.__doxaMap was set when the map was created and never cleared, so the dead map (GL
context, sources, tiles) stayed reachable from the DOM after destroy(). It is now cleared, only if
it is still this instance's. The logo-owner claim is released by the commit before this one.
This commit is contained in:
Doxa Maps 2026-09-28 20:27:47 +00:00
parent 1eae8ed80d
commit ba54af0113

View file

@ -798,7 +798,11 @@ export function useMapInstance({
const w = typeof window !== 'undefined' ? window : null
if (w && w.__doxaLogoOwner === map.value) w.__doxaLogoOwner = null
} catch (_) { /* a locked-down window is not a reason to skip the teardown below */ }
const dead = map.value
map.value.remove()
// The container kept __doxaMap after teardown, holding the whole dead map (GL context, sources,
// tiles) reachable from the DOM. Clear it only if it is still this instance's.
try { if (containerRef && containerRef.value && containerRef.value.__doxaMap === dead) containerRef.value.__doxaMap = null } catch (_) {}
map.value = null
isMapReady.value = false
}