doxa-maps/library/stores
Doxa Maps 5520587417 A collapsed legend reopens itself after you close a people-group detail
Collapse the legend, tap a pin, then close the detail: the legend comes back
open, though nothing asked it to. Reported against the leaf research map;
reproduced at 1440 in en, collapsed-first.

selectPeopleGroup saved the pre-detail legend state on every call that carried
a group, not only on the call that entered detail. The second call therefore
saved the 'open' the first call had just forced, on top of the 'collapsed' it
correctly saved on entry, and closing the detail restored that 'open'.

The measured part is why a second call happens at all. The pin click handler is
registered per map layer, and every visible pin has an invisible hitbox twin at
the same point -- same source, larger radius, added alongside it so taps are
easier to land. A layer-scoped click fires once per layer with a feature under
the point, so a single pin click calls selectPeopleGroup exactly twice, 3ms
apart. Measured on two different pins, both reporting both layers at the click
point; never more than twice. So ONE pick was already enough to lose the
collapsed state -- it never needed two, which is why this reproduced every time
rather than intermittently.

The fix is to make the method idempotent: save only when entering detail (no
group was selected before), restore only what was actually saved, then clear it
so a later detail cannot inherit a stale value. The duplicate binding is a real
defect in its own right and is tracked separately; this method should not have
depended on being called exactly once.

Verified two-sided against the shipped source, driving the real method body
rather than a copy: seven scenarios pass on the fix and four fail with the
previous body restored, while the scenarios that must be insensitive stay green
both ways. The poisoned run reproduces the browser measurement value for value
-- saved collapsed, overwritten to open by the second call, restored open.
Trace in _qa-cycle so the next reader can re-run it.
2026-09-29 11:56:47 +00:00
..
dataStore.js doxa-maps — portable bundler for embeddable JAMstack maps 2026-09-10 01:53:07 +00:00
mapStore.js Make the map's clustering picker real: four options, four different maps 2026-09-25 16:16:46 +00:00
README.md docs: simplify all folder READMEs (what's here + graphic + link); migrate complex reference to docs/architecture/{data-sources,i18n,components,app-wrappers,poster-generation}.md 2026-09-11 18:50:31 +00:00
uiStore.js A collapsed legend reopens itself after you close a people-group detail 2026-09-29 11:56:47 +00:00

library/stores/ — per-instance Pinia stores

Three stores, one responsibility each. Created fresh per <doxa-map> element and provided to descendants from ProfileLoader.vue — reach them via inject(), never a direct useXxxStore() import (LL-010, LL-023).

File Owns Example fields
mapStore.js Map state: selections, zoom, bbox, Mapbox instances selectedRegion, selectedFamily, maps[mapId], activeMapId
uiStore.js UI state: sidebar, tabs, theme, toasts, modals activeTab, sidebarCollapsed, theme, legendState
dataStore.js Data caching: GeoJSON (markRaw), fetch status, errors sources[sourceId], loadingStates[sourceId]
  • Use markRaw() on large GeoJSON — Vue should not deeply proxy it.
  • Keep state changes in named actions; stores don't import each other (cross-store coordination happens at the component level).