resources-map honours the provider switch

The last leaf the sweep found still pinned to Mapbox. Like
connectivity-map and my-upg-100-list it builds its map RAW (new gl.Map on
window.mapboxgl), so the resolution useMapInstance performs for every other
bundle never reached it: MEASURED at ?provider=maplibre it made 18 requests
to api.mapbox.com, identical to its mapbox run.

Same fix, third application, deliberately identical: the engine comes from
the shared ensureEngineScript/engineGlobal, and the two hardcoded mapbox://
style URLs are paired through the registry — 'ink' (dark-v11 / OpenFreeMap
dark) and 'paper' (light-v11 / positron). The engine loader is imported,
never re-declared.

No geocoder is mounted here, so the deferred-search-bar rule does not apply
and nothing about search behaviour changed.

MEASURED on the built tree:
  mapbox    canvas=1  18 mapbox requests  (unchanged)
  maplibre  canvas=1   4 mapbox requests  maplibregl loaded
Screenshot read: positron basemap, the gospel-resource gap choropleth, its
legend and controls all intact.

gates:pre 0. gates:post is 17/18 and the single failure is verify, which is
the PRE-EXISTING tables-complete break: commit 4475581 deliberately deleted
field-access-visas.json to close a visa-data leak while index.json still
declares it. 4475581 is an ancestor of main, so main was already red before
this flight. Filed as BUG-TABLES-COMPLETE-RED-AFTER-VISA-LEAK-FIX; not
touched here, because guessing risks re-adding leaked data.
This commit is contained in:
doxa-maps-88655c70 2026-09-24 03:20:44 +00:00
parent 874186660e
commit 12e4c5e8f7
8 changed files with 49 additions and 33 deletions

View file

@ -67,10 +67,22 @@ import LocationButton from '@map/components/map-controls/LocationButton.vue'
import FullscreenButton from '@map/components/map-controls/FullscreenButton.vue'
import ShareButton from '@map/components/map-controls/ShareButton.vue'
import { resolveAssetsBase } from '@map/utils/embedBase.js'
import { resolveMapProvider } from '@map/composables/useMapProvider.js'
import { ensureEngineScript, engineGlobal } from '@map/composables/useMapInstance.js'
import { resolveNamedStyle } from '@map/styles/registry.js'
const profileConfig = inject('profileConfig', ref(null))
const isDark = computed(() => profileConfig.value?.isDark === true)
const mapboxToken = computed(() => profileConfig.value?.tk || window.DOXA_TOKEN || '')
// ── HONOUR THE PROVIDER SWITCH: this profile builds its map RAW ─────────────
// Bundles that go through useMapInstance get the switch for free; this one calls `new gl.Map`
// directly, so it never saw it. MEASURED by sweeping all 16 isMap leaves: at ?provider=maplibre
// this leaf still loaded Mapbox and made 18 requests to api.mapbox.com, identical to its mapbox
// run. Same shape and same fix as cities-internet/connectivity-map and my-upg-100-list; the engine
// loader is IMPORTED from useMapInstance, never a second copy of the ENGINES table.
// No geocoder is mounted here, so the deferred-search-bar rule does not apply to this profile.
const grProvider = resolveMapProvider(profileConfig)
const assetsBase = computed(() => resolveAssetsBase(profileConfig.value))
const mapEl = ref(null)
@ -287,13 +299,17 @@ function paint(map, adm0) {
}
onMounted(async () => {
const gl = window.mapboxgl
if (!gl || !mapEl.value) { err.value = 'mapbox-gl not loaded'; return }
try { await ensureEngineScript(grProvider) } catch (_) { /* fall through to the notice below */ }
const gl = engineGlobal(grProvider) || window.mapboxgl
if (!gl || !mapEl.value) { err.value = 'map engine not loaded'; return }
try {
const adm0 = await load()
const map = new gl.Map({
container: mapEl.value,
style: isDark.value ? 'mapbox://styles/mapbox/dark-v11' : 'mapbox://styles/mapbox/light-v11',
// Paired through the registry so both engines show one intent: 'ink' is the near-black entry
// (mapbox dark-v11 / OpenFreeMap dark), 'paper' the near-white one (light-v11 / positron).
style: resolveNamedStyle(isDark.value ? 'ink' : 'paper', grProvider).style
|| (isDark.value ? 'mapbox://styles/mapbox/dark-v11' : 'mapbox://styles/mapbox/light-v11'),
accessToken: mapboxToken.value,
center: [42, 18], zoom: 1.3, projection: 'mercator', attributionControl: false,
})

View file

@ -26,7 +26,7 @@
<script>window.MAP_APP_API_URL = "https://pray.doxa.life";</script>
<!-- Bundle IIFE — registers the <gospel-resources-map> custom element. -->
<script src="../gospel-resources.js" integrity="sha384-VXjJ4Se+3vtAs3dnqQoWelPf88U32RffjhrVy3usV5m9HHm2fL/CfUq2maQVKhzj" crossorigin="anonymous"></script>
<script src="../gospel-resources.js" integrity="sha384-4pOAnuuOovcKXSQANV9jnLu1ExxiwQMuC4aU5MtAsd959tYmdUj05u4tT57Z/rKI" crossorigin="anonymous"></script>
<script>
// Mapbox token resolution — the A3 ladder, in precedence order:

View file

@ -26,7 +26,7 @@
<script>window.MAP_APP_API_URL = "https://pray.doxa.life";</script>
<!-- Bundle IIFE — registers the <gospel-resources-map> custom element. -->
<script src="../gospel-resources.js" integrity="sha384-VXjJ4Se+3vtAs3dnqQoWelPf88U32RffjhrVy3usV5m9HHm2fL/CfUq2maQVKhzj" crossorigin="anonymous"></script>
<script src="../gospel-resources.js" integrity="sha384-4pOAnuuOovcKXSQANV9jnLu1ExxiwQMuC4aU5MtAsd959tYmdUj05u4tT57Z/rKI" crossorigin="anonymous"></script>
<script>
// Mapbox token resolution — the A3 ladder, in precedence order:

File diff suppressed because one or more lines are too long

View file

@ -26,7 +26,7 @@
<script>window.MAP_APP_API_URL = "https://pray.doxa.life";</script>
<!-- Bundle IIFE — registers the <gospel-resources-map> custom element. -->
<script src="../gospel-resources.js" integrity="sha384-VXjJ4Se+3vtAs3dnqQoWelPf88U32RffjhrVy3usV5m9HHm2fL/CfUq2maQVKhzj" crossorigin="anonymous"></script>
<script src="../gospel-resources.js" integrity="sha384-4pOAnuuOovcKXSQANV9jnLu1ExxiwQMuC4aU5MtAsd959tYmdUj05u4tT57Z/rKI" crossorigin="anonymous"></script>
<script>
// Mapbox token resolution — the A3 ladder, in precedence order:

View file

@ -29,7 +29,7 @@
<script>window.MAP_APP_API_URL = "https://pray.doxa.life";</script>
<!-- Bundle IIFE — registers the <gospel-resources-map> custom element. -->
<script src="../gospel-resources.js" integrity="sha384-VXjJ4Se+3vtAs3dnqQoWelPf88U32RffjhrVy3usV5m9HHm2fL/CfUq2maQVKhzj" crossorigin="anonymous"></script>
<script src="../gospel-resources.js" integrity="sha384-4pOAnuuOovcKXSQANV9jnLu1ExxiwQMuC4aU5MtAsd959tYmdUj05u4tT57Z/rKI" crossorigin="anonymous"></script>
<script>
// Mapbox token resolution — the A3 ladder, in precedence order:

File diff suppressed because one or more lines are too long

View file

@ -573,7 +573,7 @@
"bundle": "gospel-resources",
"scriptUrl": "./gospel-resources/gospel-resources.js",
"output": "doxa-maps/gospel-resources/gospel-resources.js",
"integrity": "sha384-VXjJ4Se+3vtAs3dnqQoWelPf88U32RffjhrVy3usV5m9HHm2fL/CfUq2maQVKhzj",
"integrity": "sha384-4pOAnuuOovcKXSQANV9jnLu1ExxiwQMuC4aU5MtAsd959tYmdUj05u4tT57Z/rKI",
"elements": [
"gospel-resources-map"
],
@ -589,7 +589,7 @@
"scriptUrl": "./gospel-resources/gospel-resources.js",
"embed": {
"iframe": "<iframe src=\"./gospel-resources/charts/index.html?utm_source=YOUR_SOURCE\" width=\"100%\" height=\"600\" style=\"border:none;border-radius:12px;\" allowfullscreen></iframe>",
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./gospel-resources/gospel-resources.js\" integrity=\"sha384-VXjJ4Se+3vtAs3dnqQoWelPf88U32RffjhrVy3usV5m9HHm2fL/CfUq2maQVKhzj\" crossorigin=\"anonymous\"></script>\n<gospel-resources-map profile-config='{\"profile\":\"charts\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></gospel-resources-map>"
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./gospel-resources/gospel-resources.js\" integrity=\"sha384-4pOAnuuOovcKXSQANV9jnLu1ExxiwQMuC4aU5MtAsd959tYmdUj05u4tT57Z/rKI\" crossorigin=\"anonymous\"></script>\n<gospel-resources-map profile-config='{\"profile\":\"charts\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></gospel-resources-map>"
}
},
{
@ -603,7 +603,7 @@
"scriptUrl": "./gospel-resources/gospel-resources.js",
"embed": {
"iframe": "<iframe src=\"./gospel-resources/data-tables/index.html?utm_source=YOUR_SOURCE\" width=\"100%\" height=\"600\" style=\"border:none;border-radius:12px;\" allowfullscreen></iframe>",
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./gospel-resources/gospel-resources.js\" integrity=\"sha384-VXjJ4Se+3vtAs3dnqQoWelPf88U32RffjhrVy3usV5m9HHm2fL/CfUq2maQVKhzj\" crossorigin=\"anonymous\"></script>\n<gospel-resources-map profile-config='{\"profile\":\"data-tables\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></gospel-resources-map>"
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./gospel-resources/gospel-resources.js\" integrity=\"sha384-4pOAnuuOovcKXSQANV9jnLu1ExxiwQMuC4aU5MtAsd959tYmdUj05u4tT57Z/rKI\" crossorigin=\"anonymous\"></script>\n<gospel-resources-map profile-config='{\"profile\":\"data-tables\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></gospel-resources-map>"
}
},
{
@ -617,7 +617,7 @@
"scriptUrl": "./gospel-resources/gospel-resources.js",
"embed": {
"iframe": "<iframe src=\"./gospel-resources/resources-list/index.html?utm_source=YOUR_SOURCE\" width=\"100%\" height=\"600\" style=\"border:none;border-radius:12px;\" allowfullscreen></iframe>",
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./gospel-resources/gospel-resources.js\" integrity=\"sha384-VXjJ4Se+3vtAs3dnqQoWelPf88U32RffjhrVy3usV5m9HHm2fL/CfUq2maQVKhzj\" crossorigin=\"anonymous\"></script>\n<gospel-resources-map profile-config='{\"profile\":\"resources-list\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></gospel-resources-map>"
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./gospel-resources/gospel-resources.js\" integrity=\"sha384-4pOAnuuOovcKXSQANV9jnLu1ExxiwQMuC4aU5MtAsd959tYmdUj05u4tT57Z/rKI\" crossorigin=\"anonymous\"></script>\n<gospel-resources-map profile-config='{\"profile\":\"resources-list\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></gospel-resources-map>"
}
},
{
@ -631,7 +631,7 @@
"scriptUrl": "./gospel-resources/gospel-resources.js",
"embed": {
"iframe": "<iframe src=\"./gospel-resources/resources-map/index.html?utm_source=YOUR_SOURCE\" width=\"100%\" height=\"600\" style=\"border:none;border-radius:12px;\" allowfullscreen></iframe>",
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./gospel-resources/gospel-resources.js\" integrity=\"sha384-VXjJ4Se+3vtAs3dnqQoWelPf88U32RffjhrVy3usV5m9HHm2fL/CfUq2maQVKhzj\" crossorigin=\"anonymous\"></script>\n<gospel-resources-map profile-config='{\"profile\":\"resources-map\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></gospel-resources-map>"
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./gospel-resources/gospel-resources.js\" integrity=\"sha384-4pOAnuuOovcKXSQANV9jnLu1ExxiwQMuC4aU5MtAsd959tYmdUj05u4tT57Z/rKI\" crossorigin=\"anonymous\"></script>\n<gospel-resources-map profile-config='{\"profile\":\"resources-map\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></gospel-resources-map>"
}
}
]