[Lens] fixes annotations layer removal bug (#138355) (#138367)

(cherry picked from commit 306ad2b79f)

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
This commit is contained in:
Kibana Machine 2022-08-09 06:45:10 -04:00 committed by GitHub
parent 4390d289c5
commit c332f5bbb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -190,17 +190,19 @@ export function LayerPanels(
const layerDatasource = datasourceMap[datasourceId];
const layerDatasourceState = datasourceStates?.[datasourceId]?.state;
const trigger = props.uiActions.getTrigger(UPDATE_FILTER_REFERENCES_TRIGGER);
const action = props.uiActions.getAction(UPDATE_FILTER_REFERENCES_ACTION);
if (datasourceId) {
const trigger = props.uiActions.getTrigger(UPDATE_FILTER_REFERENCES_TRIGGER);
const action = props.uiActions.getAction(UPDATE_FILTER_REFERENCES_ACTION);
action?.execute({
trigger,
fromDataView: layerDatasource.getUsedDataView(layerDatasourceState, layerId),
usedDataViews: layerDatasource
.getLayers(layerDatasourceState)
.map((layer) => layerDatasource.getUsedDataView(layerDatasourceState, layer)),
defaultDataView: layerDatasource.getCurrentIndexPatternId(layerDatasourceState),
} as ActionExecutionContext);
action?.execute({
trigger,
fromDataView: layerDatasource.getUsedDataView(layerDatasourceState, layerId),
usedDataViews: layerDatasource
.getLayers(layerDatasourceState)
.map((layer) => layerDatasource.getUsedDataView(layerDatasourceState, layer)),
defaultDataView: layerDatasource.getCurrentIndexPatternId(layerDatasourceState),
} as ActionExecutionContext);
}
dispatchLens(
removeOrClearLayer({