connectivity-map honours the provider switch

Found by verifying the GOAL rather than the checklist. The rollout table
only ever listed plugins with a search bar, so a sweep of all 16 isMap
leaves was run under both providers: 12 of 16 swapped, and this leaf made
18 requests to api.mapbox.com under ?provider=maplibre — identical to its
mapbox run, because it builds its map RAW (new gl.Map on window.mapboxgl)
and never reaches the resolution useMapInstance does for everyone else.

Same shape and same fix as my-upg-100-list, minus the token gate this file
never had: the engine comes from the shared ensureEngineScript/engineGlobal
rather than a hardcoded global, and the two hardcoded mapbox:// style URLs
are paired through the registry — 'ink' (dark-v11 / OpenFreeMap dark) and
'paper' (light-v11 / positron) — so both engines show one intent. The
engine loader is imported, never re-declared; a second ENGINES table in a
profile is how two copies of one fact drift apart.

No geocoder is mounted here, so the deferred-search-bar rule does not apply
and nothing about the 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, connectivity choropleth, legend and
controls all intact.

Also recorded from the sweep: poster-wall and regions-list draw NO canvas on
either engine — they are the already-filed isMap misclassification, not
gaps, and must not be "fixed".

7/7 pre, 18/18 post.
This commit is contained in:
doxa-maps-88655c70 2026-09-24 03:14:35 +00:00
parent fb44125c18
commit 34cb921b96
7 changed files with 47 additions and 30 deletions

View file

@ -46,6 +46,9 @@ 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)
@ -127,14 +130,28 @@ function paint(map, adm0) {
map.on('mouseleave', 'ci-fill', () => { map.getCanvas().style.cursor = '' })
}
// ── HONOUR THE PROVIDER SWITCH: this profile builds its map RAW ─────────────
// Every bundle that goes through useMapInstance gets the switch for free. This one calls
// `new gl.Map` directly, so it was invisible to 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, while 12 of 16 siblings swapped. Same shape and same fix as
// my-upg-100-list; the engine loader is IMPORTED, 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 ciProvider = resolveMapProvider(inject('profileConfig', null))
onMounted(async () => {
const gl = window.mapboxgl
if (!gl || !mapEl.value) { err.value = 'mapbox-gl not loaded'; return }
try { await ensureEngineScript(ciProvider) } catch (_) { /* fall through to the notice below */ }
const gl = engineGlobal(ciProvider) || 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 the same intent: 'ink' is the
// near-black entry (mapbox dark-v11 / OpenFreeMap dark) and 'paper' the near-white one
// (light-v11 / positron). Falls back to the literal if a name ever stops resolving.
style: resolveNamedStyle(isDark.value ? 'ink' : 'paper', ciProvider).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,
})

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 <cities-internet-map> custom element. -->
<script src="../cities-internet.js" integrity="sha384-VfbtDah7CcZdh9U1LNojwqD50sWSZIzYogPohoATgibTn1s00jLOdq4/98uSfsi+" crossorigin="anonymous"></script>
<script src="../cities-internet.js" integrity="sha384-tNig8gXdCocWVKD5iXR6iRqiAr7msWFtcFKzYif0L0G5i/RM+HI+SO8oR5c6O+5R" 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 <cities-internet-map> custom element. -->
<script src="../cities-internet.js" integrity="sha384-VfbtDah7CcZdh9U1LNojwqD50sWSZIzYogPohoATgibTn1s00jLOdq4/98uSfsi+" crossorigin="anonymous"></script>
<script src="../cities-internet.js" integrity="sha384-tNig8gXdCocWVKD5iXR6iRqiAr7msWFtcFKzYif0L0G5i/RM+HI+SO8oR5c6O+5R" 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 <cities-internet-map> custom element. -->
<script src="../cities-internet.js" integrity="sha384-VfbtDah7CcZdh9U1LNojwqD50sWSZIzYogPohoATgibTn1s00jLOdq4/98uSfsi+" crossorigin="anonymous"></script>
<script src="../cities-internet.js" integrity="sha384-tNig8gXdCocWVKD5iXR6iRqiAr7msWFtcFKzYif0L0G5i/RM+HI+SO8oR5c6O+5R" 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

@ -101,7 +101,7 @@
"bundle": "cities-internet",
"scriptUrl": "./cities-internet/cities-internet.js",
"output": "doxa-maps/cities-internet/cities-internet.js",
"integrity": "sha384-VfbtDah7CcZdh9U1LNojwqD50sWSZIzYogPohoATgibTn1s00jLOdq4/98uSfsi+",
"integrity": "sha384-tNig8gXdCocWVKD5iXR6iRqiAr7msWFtcFKzYif0L0G5i/RM+HI+SO8oR5c6O+5R",
"elements": [
"cities-internet-map"
],
@ -117,7 +117,7 @@
"scriptUrl": "./cities-internet/cities-internet.js",
"embed": {
"iframe": "<iframe src=\"./cities-internet/connectivity-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=\"./cities-internet/cities-internet.js\" integrity=\"sha384-VfbtDah7CcZdh9U1LNojwqD50sWSZIzYogPohoATgibTn1s00jLOdq4/98uSfsi+\" crossorigin=\"anonymous\"></script>\n<cities-internet-map profile-config='{\"profile\":\"connectivity-list\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></cities-internet-map>"
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./cities-internet/cities-internet.js\" integrity=\"sha384-tNig8gXdCocWVKD5iXR6iRqiAr7msWFtcFKzYif0L0G5i/RM+HI+SO8oR5c6O+5R\" crossorigin=\"anonymous\"></script>\n<cities-internet-map profile-config='{\"profile\":\"connectivity-list\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></cities-internet-map>"
}
},
{
@ -131,7 +131,7 @@
"scriptUrl": "./cities-internet/cities-internet.js",
"embed": {
"iframe": "<iframe src=\"./cities-internet/connectivity-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=\"./cities-internet/cities-internet.js\" integrity=\"sha384-VfbtDah7CcZdh9U1LNojwqD50sWSZIzYogPohoATgibTn1s00jLOdq4/98uSfsi+\" crossorigin=\"anonymous\"></script>\n<cities-internet-map profile-config='{\"profile\":\"connectivity-map\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></cities-internet-map>"
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./cities-internet/cities-internet.js\" integrity=\"sha384-tNig8gXdCocWVKD5iXR6iRqiAr7msWFtcFKzYif0L0G5i/RM+HI+SO8oR5c6O+5R\" crossorigin=\"anonymous\"></script>\n<cities-internet-map profile-config='{\"profile\":\"connectivity-map\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></cities-internet-map>"
}
},
{
@ -145,7 +145,7 @@
"scriptUrl": "./cities-internet/cities-internet.js",
"embed": {
"iframe": "<iframe src=\"./cities-internet/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=\"./cities-internet/cities-internet.js\" integrity=\"sha384-VfbtDah7CcZdh9U1LNojwqD50sWSZIzYogPohoATgibTn1s00jLOdq4/98uSfsi+\" crossorigin=\"anonymous\"></script>\n<cities-internet-map profile-config='{\"profile\":\"data-tables\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></cities-internet-map>"
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./cities-internet/cities-internet.js\" integrity=\"sha384-tNig8gXdCocWVKD5iXR6iRqiAr7msWFtcFKzYif0L0G5i/RM+HI+SO8oR5c6O+5R\" crossorigin=\"anonymous\"></script>\n<cities-internet-map profile-config='{\"profile\":\"data-tables\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></cities-internet-map>"
}
}
]