Merge branch 'regions/one-profile-default' into regions/handoff-integration

This commit is contained in:
Doxa Maps 2026-09-29 14:54:47 +00:00
commit 85c02b1e5d

View file

@ -85,7 +85,30 @@ const config = computed(() => {
return parsed
})
const profileName = computed(() => config.value?.profile || null)
const profileModules = inject('profileModules', null)
if (!profileModules) {
throw new Error('[ProfileLoader] No profileModules provided. Bundle entry must `app.provide("profileModules", import.meta.glob("./*.vue"))`')
}
// ★ A ONE-PROFILE BUNDLE ANSWERS A BARE TAG (rega, DX Life drop-in, 2026-09-29). Every country page
// rendered `⚠️ Profile "" not found.` where its map should be: the host wrote <doxa-country-map>
// with no profile-config, profileName resolved to null, and the loader had nothing to load — while
// the element sat in the DOM at full size with 0 console errors and 0 failed requests, which is why
// it read as a blank map rather than a misconfiguration.
// For a bundle that registers exactly ONE profile there is no ambiguity to resolve: the only
// profile IS the answer, and requiring the host to name it makes a single-element bundle harder to
// embed than the paste-anywhere promise it exists for. 20 of the 25 bundles are single-profile.
// A bundle with SEVERAL profiles still requires the name — guessing there would silently mount the
// wrong surface, which is worse than the warning. So the fallback is conditional on the count, not
// on the name being absent.
const ONLY_PROFILE = (() => {
const keys = Object.keys(profileModules || {})
if (keys.length !== 1) return null
const m = keys[0].match(/^\.\/(.+)\.vue$/)
return m ? m[1] : null
})()
const profileName = computed(() => config.value?.profile || ONLY_PROFILE || null)
// TOKEN: profile-config.tk FIRST, then the page global.
//
// WHY THE FALLBACK (root cause, measured 2026-09-21). A COMPOSITE leaf — a cap-4/cap-5 shell
@ -266,10 +289,7 @@ const instanceId = computed(() =>
// because import.meta.glob cannot cross package boundaries — it must be
// evaluated by the bundle that owns the profile .vue files.
const profileModules = inject('profileModules', null)
if (!profileModules) {
throw new Error('[ProfileLoader] No profileModules provided. Bundle entry must `app.provide("profileModules", import.meta.glob("./*.vue"))`')
}
// (injected above, where profileName needs it to resolve a single-profile default.)
// ─── Async component — loads the resolved profile file ───────────────────────