My UPG Neighbors: the Language Clusters lens draws its map again

395a66c9 translated the lens and put `const nt = useNeighborT()` at line 387,
but setup reads nt() at line 68 (statusMsg's first text). A const read before
its line is a TDZ ReferenceError, so setup threw "Cannot access 'nt' before
initialization" and the lens rendered nothing, map included, on both engines
(rega, check:leaf-engine-per-provider on main c8fee416).

The translator is now defined above its first use. Of the other files that
commit touched, only flower-mesh uses nt() above its definition, and there it
is inside a hover handler that runs after setup, so it is safe.

Headless (_qa-cycle/exp-shepherd/lc-probe.mjs: the check:composites-mount
harness, mounting the lens under ProfileLoader's provides):
  main  lang-cluster: setup THREW, ReferenceError: Cannot access 'nt' before initialization
  fix   lang-cluster: setup ran clean (send-map, which draws, also runs clean)
This commit is contained in:
Doxa Maps 2026-09-26 04:12:13 +00:00
parent bd7d285e6d
commit 3e176d2bf8

View file

@ -52,6 +52,11 @@ function reachedColor(pct) { // green ramp by %Christian (sender
return '#9bcf9b'
}
// The lens's translator, defined BEFORE anything in setup calls it: statusMsg below does, and a
// `const` read before its line is a TDZ ReferenceError that throws setup and leaves no map at all.
import { useNeighborT } from './composables/useNeighborT.js'
const nt = useNeighborT()
// ─── inject() from ProfileLoader ──────────────────────────────────────────────
const profileConfig = inject('profileConfig')
const mapboxToken = inject('mapboxToken')
@ -382,8 +387,6 @@ function onMove(ev) { if (tip.value.show) { tip.value.x = ev.clientX; tip.value.
// adminUrl/dataUrl/dataBase still override live (loadJSON below).
import bakedReached from './data/reached-neighbors.json'
import bakedAdmin1 from './data/admin1-membership.json'
import { useNeighborT } from './composables/useNeighborT.js'
const nt = useNeighborT()
async function loadJSON(relCandidates) {
for (const url of relCandidates) {
try { const r = await fetch(url); if (r.ok) return await r.json() } catch (_) {}