Geomap: Only filter if there is a match (#110996)

This commit is contained in:
Drew Slobodnjak 2025-09-29 13:28:50 -07:00 committed by GitHub
parent 98779838ab
commit d0d55b3c68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 5 deletions

View File

@ -101,7 +101,9 @@ export function getLayerEditor(opts: LayerEditorOptions): NestedPanelOptions<Map
// If `filterData` exists filter data feeding into location editor
if (options.filterData) {
const matcherFunc = getFrameMatchers(options.filterData);
data = data.filter(matcherFunc);
if (data.some(matcherFunc)) {
data = data.filter(matcherFunc);
}
}
addLocationFields('Location', 'location.', builder, options.location, data);

View File

@ -26,10 +26,12 @@ export const applyLayerFilter = (
let panelData = panelDataProps;
if (options.filterData) {
const matcherFunc = getFrameMatchers(options.filterData);
panelData = {
...panelData,
series: panelData.series.filter(matcherFunc),
};
if (panelData.series.some(matcherFunc)) {
panelData = {
...panelData,
series: panelData.series.filter(matcherFunc),
};
}
}
handler.update(panelData);
}