diff --git a/app/components/DoxaMapSlot.vue b/app/components/DoxaMapSlot.vue index 7398dd6a..5508a682 100644 --- a/app/components/DoxaMapSlot.vue +++ b/app/components/DoxaMapSlot.vue @@ -21,6 +21,14 @@ useDoxaMap(props.bundle) const tagName = props.bundle === 'research-map' ? 'doxa-research-map' : 'doxa-map' const isSimple = props.bundle === 'simple-map' +/* Until the map's element is defined (its scripts are still downloading on a cold first visit), + * the slot would be an empty box. Show a quiet spinner instead, so the wait reads as loading. */ +const ready = ref(false) +onMounted(() => { + if (typeof customElements === 'undefined') return + customElements.whenDefined(tagName).then(() => { ready.value = true }) +}) + /* With no Mapbox token configured (e.g. a fresh checkout with no .env), the * map would refuse to start ("No Mapbox access token provided"). Ask the * dx-maps bundle for its keyless MapLibre engine instead, as the Research @@ -36,7 +44,8 @@ const effectiveConfig = computed(() => {