From c9c2280241c6050ed0ba2ca811a6441d32cdf9ab Mon Sep 17 00:00:00 2001 From: Doxa Maps Date: Mon, 28 Sep 2026 19:53:45 +0000 Subject: [PATCH] Pplr Data Maps: its verification hooks leave window when a view closes, so a closed view no longer keeps the whole app in memory --- plugin-designs/pplr-data-maps/src/utils/pplrData.js | 10 ++++++++++ .../pplr-data-maps/src/views/pplr-coverage.vue | 12 +++++++++--- .../src/views/pplr-language-families.vue | 4 ++-- .../pplr-data-maps/src/views/pplr-pins.vue | 4 ++-- .../pplr-data-maps/src/views/pplr-religion.vue | 4 ++-- .../pplr-data-maps/src/views/pplr-rop-tree.vue | 4 ++-- .../pplr-data-maps/src/views/pplr-rosetta-cards.vue | 4 ++-- .../pplr-data-maps/src/views/pplr-translations.vue | 4 ++-- 8 files changed, 31 insertions(+), 15 deletions(-) diff --git a/plugin-designs/pplr-data-maps/src/utils/pplrData.js b/plugin-designs/pplr-data-maps/src/utils/pplrData.js index c65c9a130..862cfdd39 100644 --- a/plugin-designs/pplr-data-maps/src/utils/pplrData.js +++ b/plugin-designs/pplr-data-maps/src/utils/pplrData.js @@ -104,8 +104,10 @@ export function setProjectionFor(map, name) { // Verification handle (the gospel-resources __grState contract): what the ACTIVE view's map // actually did, so a check can assert "loaded" rather than inferring it from missing requests. // window.__pplrMap() -> { engine, loaded, styleLayers, pplrLayers } +let _exposedMap = null // whose hook is on window, so releaseMap only clears its own export function exposeMap(map) { if (typeof window === 'undefined' || !map) return + _exposedMap = map let loaded = false map.once('load', () => { loaded = true }) window.__pplrMap = () => { @@ -123,3 +125,11 @@ export function exposeMap(map) { } } } + +// Release the hook on unmount (a closure on window pins the whole app after the view is gone; rega +// measured ~10 MB per mount). Only if it is still THIS map's: another view may have exposed its own since. +export function releaseMap(map) { + if (typeof window === 'undefined' || !map || _exposedMap !== map) return + delete window.__pplrMap + _exposedMap = null +} diff --git a/plugin-designs/pplr-data-maps/src/views/pplr-coverage.vue b/plugin-designs/pplr-data-maps/src/views/pplr-coverage.vue index 6936aa2f2..7bea016a9 100644 --- a/plugin-designs/pplr-data-maps/src/views/pplr-coverage.vue +++ b/plugin-designs/pplr-data-maps/src/views/pplr-coverage.vue @@ -1,5 +1,5 @@