feat: add bidirectional map/table selection sync to collapsible data table [PR2] - #3720
feat: add bidirectional map/table selection sync to collapsible data table [PR2]#3720BRaimbault wants to merge 7 commits into
Conversation
|
🚀 Deployed on https://pr-3720.maps.netlify.dhis2.org |
1489b0f to
782301d
Compare
782301d to
2e5fe4f
Compare
|
There was a problem hiding this comment.
In general this looks good. I did leave some comments which you can take or leave.
Another thing I noticed while reviewing was a general pattern where I saw:
- A diff in the prop-types
- A diff in the props in the function signature
- No changes in the function body
- A diff in the JSX where the added props being passed down to descendants
So this is prop-drilling and you could consider addressing it by introducing a/multiple context providers and maybe some hooks. But this is just a casual comment. I didn't look into it deeply and also realise this is a codebase with a mix of function and class components, so it could get messy.
| index, | ||
| })) | ||
| }, [data, dataWithoutCoords, aggregations, serverCluster, layerType]) | ||
| // boundsDependency intentionally proxies mapBounds only while the toggle is on |
There was a problem hiding this comment.
Comment is not very clear and possible misplaced too, it looks to be referring to L227
| this.handleFeatureChange(prevProps) | ||
| this.handleSelectionChange(prevProps) | ||
| this.handleHighlightColorChange(prevProps) | ||
| this.handleVisibleIdsChange(prevProps) |
There was a problem hiding this comment.
While it's good to extract things into separate methods, the naming you went with is a bit misleading on various levels:
- "handling change" creates an association with event handlers
- "handle" + some noun + "change" suggests that thing changed, while the bulk of the code is actually there to detect if a relevant change actually happened
Maybe something with "sync" and then what will conditionally be synced, i.e.
syncLayerData(prevProps, prevState) // MAYBE NOT SO GREAT
syncLayerOrder(prevProps)
syncOpacity(prevProps)
syncVisibility(prevProps)
syncFeature(prevProps)
syncSelectedFeatures(prevProps)
syncHighlightColor(prevProps)
syncVisibleIds(prevProps)


Part of DHIS2-21456
Description
Adds bidirectional highlighting/selection sync between the map and data table, persistent multi-feature selection, and a collapsible/resizable table panel. Second in the data table improvement series, building on PR1's toolbar and context menu.
Selection (DataTable)
selectionreducer, scoped per layer, and resets on layer switchMap ↔ table sync
@dhis2/ui's native greytr:hoverstyle while map-hover showed our own blue highlight)Filtering
Zoom actions
Table panel (BottomPanel)
Bug fixes
.includes()scans in selection filtering replaced with O(1)SetlookupsmapStateToPropswhen no context menu is openmaps-gl
Cluster.setVisibleIds()override: "show only selected" now re-clusters from the filtered feature set (viasource.setData()) instead of applying a GL filter expression, which can't target cluster circles (they carry no per-feature id). Applies to client- and donut-clustered event layers; server-clustered layers are unaffected since their data table is already unsupported today (unrelated pre-existing limitation)Layer#panToFeature()now accepts an array of ids, fitting the map to their combined boundsQuality checklist
Add N/A to items that are not applicable.
Screenshots
supporting images