mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
fix onDataLoadEnd and onDataLoadError event handler callbacks only called for source data requests (#134786)
* fix onDataLoadEnd and onDataLoadError event handler callbacks only called for source data requests * dataLoadEnd Co-authored-by: Liza Katz <liza.katz@elastic.co>
This commit is contained in:
parent
be71c903b9
commit
501927443a
1 changed files with 26 additions and 26 deletions
|
@ -287,27 +287,27 @@ function endDataLoad(
|
|||
throw new DataRequestAbortError();
|
||||
}
|
||||
|
||||
if (dataId === SOURCE_DATA_REQUEST_ID) {
|
||||
const features = data && 'features' in data ? (data as FeatureCollection).features : [];
|
||||
const layer = getLayerById(layerId, getState());
|
||||
const features = data && 'features' in data ? (data as FeatureCollection).features : [];
|
||||
const layer = getLayerById(layerId, getState());
|
||||
|
||||
const eventHandlers = getEventHandlers(getState());
|
||||
if (eventHandlers && eventHandlers.onDataLoadEnd) {
|
||||
const resultMeta: ResultMeta = {};
|
||||
if (layer && layer.getType() === LAYER_TYPE.GEOJSON_VECTOR) {
|
||||
const featuresWithoutCentroids = features.filter((feature) => {
|
||||
return feature.properties ? !feature.properties[KBN_IS_CENTROID_FEATURE] : true;
|
||||
});
|
||||
resultMeta.featuresCount = featuresWithoutCentroids.length;
|
||||
}
|
||||
|
||||
eventHandlers.onDataLoadEnd({
|
||||
layerId,
|
||||
dataId,
|
||||
resultMeta,
|
||||
const eventHandlers = getEventHandlers(getState());
|
||||
if (eventHandlers && eventHandlers.onDataLoadEnd) {
|
||||
const resultMeta: ResultMeta = {};
|
||||
if (layer && layer.getType() === LAYER_TYPE.GEOJSON_VECTOR) {
|
||||
const featuresWithoutCentroids = features.filter((feature) => {
|
||||
return feature.properties ? !feature.properties[KBN_IS_CENTROID_FEATURE] : true;
|
||||
});
|
||||
resultMeta.featuresCount = featuresWithoutCentroids.length;
|
||||
}
|
||||
|
||||
eventHandlers.onDataLoadEnd({
|
||||
layerId,
|
||||
dataId,
|
||||
resultMeta,
|
||||
});
|
||||
}
|
||||
|
||||
if (dataId === SOURCE_DATA_REQUEST_ID) {
|
||||
if (layer) {
|
||||
dispatch(updateTooltipStateForLayer(layer, features));
|
||||
}
|
||||
|
@ -343,16 +343,16 @@ function onDataLoadError(
|
|||
) => {
|
||||
dispatch(unregisterCancelCallback(requestToken));
|
||||
|
||||
if (dataId === SOURCE_DATA_REQUEST_ID) {
|
||||
const eventHandlers = getEventHandlers(getState());
|
||||
if (eventHandlers && eventHandlers.onDataLoadError) {
|
||||
eventHandlers.onDataLoadError({
|
||||
layerId,
|
||||
dataId,
|
||||
errorMessage,
|
||||
});
|
||||
}
|
||||
const eventHandlers = getEventHandlers(getState());
|
||||
if (eventHandlers && eventHandlers.onDataLoadError) {
|
||||
eventHandlers.onDataLoadError({
|
||||
layerId,
|
||||
dataId,
|
||||
errorMessage,
|
||||
});
|
||||
}
|
||||
|
||||
if (dataId === SOURCE_DATA_REQUEST_ID) {
|
||||
const layer = getLayerById(layerId, getState());
|
||||
if (layer) {
|
||||
dispatch(updateTooltipStateForLayer(layer));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue