Files
superset2/superset-frontend/plugins/plugin-chart-country-map/test/plugin/controlPanel.test.ts
Superset Dev d1a7c9e82f fix(plugin-chart-country-map): control-panel UX — validators, dynamic choices, visibility
Four UX bugs reported on the new country map chart:

1. **"Country: cannot be empty" stuck on the Data tab even at Admin 0.**
   The Country control had a hard `validators: [validateNonEmpty]`, but
   it's only rendered (and only meaningful) when admin_level != 0 and no
   composite is set. The validator was firing for the hidden empty value
   and trapped the user — the Update Chart button was permanently
   disabled with no visible control to satisfy. Switched to a dynamic
   validator via mapStateToProps so it only fires when the field is
   actually needed.

2. **"Aggregated regions" threw TypeError: t.map is not a function.**
   The region_set control used `choices: ({ controls }) => ...`, but
   SelectControl's `choices` must be a literal array. Moved the
   country-dependent choice computation into `mapStateToProps` (same
   pattern other plugins use).

3. **Composite map always visible and "sticky" overriding admin_level.**
   At Admin 0 (world choropleth) the composite override produced a map
   that didn't change when you toggled admin_level. Hidden composite
   control at Admin 0 entirely, and hidden it whenever the build
   pipeline didn't emit any composites — leaves room for future
   per-country scoping (e.g. only show france_overseas when country=FRA).

4. **Show flying islands checkbox was a no-op.** The build pipeline
   doesn't currently tag features as flying, so the runtime drop logic
   had nothing to act on. Removed from the control set rather than ship
   a misleading control; a single line brings it back once the build
   tags features.

Tests updated to cover all four behaviors.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 09:29:03 -07:00

6.9 KiB