From e4b5a3d1b140e4d851c4cc863dd32445c3d3e3e2 Mon Sep 17 00:00:00 2001 From: Doxa Maps Date: Tue, 29 Sep 2026 23:08:17 +0000 Subject: [PATCH] Prayer Progress released mid-start no longer reports a failed map Prayer Progress is a heavy gallery tab: switching away empties its slot. If the map is still starting, initializeMap returns silently (useMapInstance's liveness checks) and leaves map.value null. onMounted then logged "[doxa-simple-map] Map failed to initialize, check token and container": a console error that blamed the token for a tab switch. Measured on development's tip, served from its committed tree, on the shared browser, a phone in Arabic (pp-fastswitch.mjs): switched away 150 and 500 ms after selecting the tab, 2 runs in 10 logged it. The control runs, switched away after a full start or never switched away, logged nothing. Same shape as the research map's quiet cancel (0c263fb60): when the map's container is gone or detached, both failure paths return quietly. A mounted pane that really fails still logs. --- plugin-designs/doxa-simple-map/doxa-simple-map.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugin-designs/doxa-simple-map/doxa-simple-map.vue b/plugin-designs/doxa-simple-map/doxa-simple-map.vue index d1550b350..70f271b3c 100644 --- a/plugin-designs/doxa-simple-map/doxa-simple-map.vue +++ b/plugin-designs/doxa-simple-map/doxa-simple-map.vue @@ -1356,9 +1356,18 @@ onMounted(async () => { }) // 2. Initialize map (returns before 'load' fires) + // ★ A PANE RELEASED WHILE ITS MAP IS STILL STARTING IS A CANCEL, NOT A FAILURE. This map is a heavy + // gallery tab: switching away empties its slot. initializeMap then returns SILENTLY (useMapInstance's + // liveness checks) and leaves map.value null, which this reported as "Map failed to initialize — + // check token and container": a console ERROR blaming the token for a tab switch (measured + // 2026-09-29, a phone in Arabic, switched away 150 and 500 ms in: 2 runs in 10; 0 when the map was + // left to start). Nobody is waiting for this map any more, so return quietly. A mounted pane that + // really fails still logs. + const released = () => !mapContainer.value || !mapContainer.value.isConnected try { await initializeMap() } catch (err) { + if (released()) return // `new mapboxgl.Map()` throws outright when the device has no WebGL context. console.error('[doxa-simple-map] Map failed to initialize —', err) mapError.value = String(err?.message || err) @@ -1367,6 +1376,7 @@ onMounted(async () => { unwrapMap() if (!map.value) { + if (released()) return console.error('[doxa-simple-map] Map failed to initialize — check token and container') mapError.value = t('simpleMap.initFailed') return