Fix empty layers spinning forever in Multi Map legend#352
Open
ethanbienstock wants to merge 3 commits into
Open
Fix empty layers spinning forever in Multi Map legend#352ethanbienstock wants to merge 3 commits into
ethanbienstock wants to merge 3 commits into
Conversation
When a layer loads but has no data (e.g., filtered to a year with no storms), loadSingleLayer now returns an entry with empty: true on the legend instead of null. This lets the legend replace the loading spinner with a gray checkbox, distinguishing "loaded but empty" from "still loading". Applies to all layer types (eager, autozoom, and lazy). Closes raft-tech#350 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Show a gray text label aligned with the group title when a layer loads successfully but returns no data, replacing the previous silent state that left users staring at a spinner. Add six tests covering the empty layer state, loading precedence, and the loading-to-empty transition. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #350
Focus Score
9/10 — All changes are tightly scoped to one bug: empty layers causing an infinite spinner in the Multi Map legend. The only files touched are the legend component, its test file, the layer processing logic in Multi.tsx, and the shared type definition. The formatting commit is a minor tangent but affects the same file.
Detailed Summary of Each File Changed
superset-frontend/plugins/geoset-map-chart/src/GeoSetMultiMap/Multi.tsxreturn nullwhengetGeoSetMapLayerreturns null (empty data)layerStatesGeneratorcall to a ternary that returns[]whennewLayeris falsy!newLayerStates.lengthbranch fromreturn nullto settinglegendEntry.empty = true, so the entry still reaches the legendsuperset-frontend/plugins/geoset-map-chart/src/components/MultiLegend.tsxNoDataLabelstyled component (gray, 11px, aligned with group title viamargin-left: -20px)legendEntry.emptyis true$emptytransient prop toVisibilityCheckboxandIndeterminateCheckboxto applyaccent-color: graystylingallEmptyat the group level for the group header checkboxsuperset-frontend/plugins/geoset-map-chart/src/types.tsempty?: booleanfield to theLegendEntrytypesuperset-frontend/plugins/geoset-map-chart/test/components/MultiLegend.test.tsxempty layer statedescribe block:Test Plan
npx jest --config jest.config.js plugins/geoset-map-chart/test/components/MultiLegend.test.tsx— all 30 tests should pass