diff --git a/x-pack/legacy/plugins/siem/public/components/embeddables/__mocks__/mock.ts b/x-pack/legacy/plugins/siem/public/components/embeddables/__mocks__/mock.ts index 3f82076ca127b..03e425758b1ad 100644 --- a/x-pack/legacy/plugins/siem/public/components/embeddables/__mocks__/mock.ts +++ b/x-pack/legacy/plugins/siem/public/components/embeddables/__mocks__/mock.ts @@ -216,6 +216,6 @@ export const mockLayerListDouble = [ export const mockMapLayerEventHandlers: MapLayerEventHandlers = { onDataLoad: ({ layerId, dataId }: OnDataLoadProps) => {}, - onDataLoadEnd: ({ layerId, dataId, featuresCount }: OnDataLoadEndProps) => {}, + onDataLoadEnd: ({ layerId, dataId, resultMeta }: OnDataLoadEndProps) => {}, onDataLoadError: ({ layerId, dataId, errorMessage }: OnDataLoadErrorProps) => {}, }; diff --git a/x-pack/legacy/plugins/siem/public/components/embeddables/hooks/use_map_layers.tsx b/x-pack/legacy/plugins/siem/public/components/embeddables/hooks/use_map_layers.tsx index 437474a0e61fd..e34941b39ceba 100644 --- a/x-pack/legacy/plugins/siem/public/components/embeddables/hooks/use_map_layers.tsx +++ b/x-pack/legacy/plugins/siem/public/components/embeddables/hooks/use_map_layers.tsx @@ -53,9 +53,15 @@ export const useMapLayers = (): Return => { onDataLoad: ({ layerId, dataId }: OnDataLoadProps) => { setMapLayers(prevMapLayers => mergeMapLayers(prevMapLayers, dataId, layerId, true)); }, - onDataLoadEnd: ({ layerId, dataId, featuresCount }: OnDataLoadEndProps) => { + onDataLoadEnd: ({ layerId, dataId, resultMeta }: OnDataLoadEndProps) => { setMapLayers(prevMapLayers => - mergeMapLayers(prevMapLayers, dataId, layerId, false, featuresCount) + mergeMapLayers( + prevMapLayers, + dataId, + layerId, + false, + resultMeta.featuresCount != null ? resultMeta.featuresCount : 0 + ) ); }, onDataLoadError: ({ layerId, dataId, errorMessage }: OnDataLoadErrorProps) => { diff --git a/x-pack/legacy/plugins/siem/public/components/embeddables/types.ts b/x-pack/legacy/plugins/siem/public/components/embeddables/types.ts index 1802f4cf42411..72776fe8df52c 100644 --- a/x-pack/legacy/plugins/siem/public/components/embeddables/types.ts +++ b/x-pack/legacy/plugins/siem/public/components/embeddables/types.ts @@ -75,7 +75,9 @@ export interface OnDataLoadProps { export interface OnDataLoadEndProps { layerId: string; dataId: string; - featuresCount: number; + resultMeta: { + featuresCount: number; + }; } export interface OnDataLoadErrorProps { @@ -86,7 +88,7 @@ export interface OnDataLoadErrorProps { export interface MapLayerEventHandlers { onDataLoad({ layerId, dataId }: OnDataLoadProps): void; - onDataLoadEnd({ layerId, dataId, featuresCount }: OnDataLoadEndProps): void; + onDataLoadEnd({ layerId, dataId, resultMeta }: OnDataLoadEndProps): void; onDataLoadError({ layerId, dataId, errorMessage }: OnDataLoadErrorProps): void; }