diff --git a/x-pack/plugins/apm/public/components/app/mobile/service_overview/geo_map/embedded_map.test.tsx b/x-pack/plugins/apm/public/components/app/mobile/service_overview/geo_map/embedded_map.test.tsx index 82bbd07ba8588..43d7c75573944 100644 --- a/x-pack/plugins/apm/public/components/app/mobile/service_overview/geo_map/embedded_map.test.tsx +++ b/x-pack/plugins/apm/public/components/app/mobile/service_overview/geo_map/embedded_map.test.tsx @@ -6,6 +6,7 @@ */ import { render } from '@testing-library/react'; +import { DataView } from '@kbn/data-views-plugin/common'; import React from 'react'; import { EmbeddedMap } from './embedded_map'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; @@ -37,6 +38,17 @@ describe('Embedded Map', () => { .mockImplementation(() => ({ id: 'mockSpaceId' })), }; + const mockDataView = { + id: 'mock-id', + title: 'mock-title', + timeFieldName: '@timestamp', + isPersisted: () => false, + getName: () => 'mock-data-view', + toSpec: () => ({}), + fields: [], + metaFields: [], + } as unknown as DataView; + const { findByTestId } = render( { filters={[]} start="2022-12-20T10:00:00.000Z" end="2022-12-20T10:15:00.000Z" + dataView={mockDataView} /> diff --git a/x-pack/plugins/apm/public/components/app/mobile/service_overview/geo_map/embedded_map.tsx b/x-pack/plugins/apm/public/components/app/mobile/service_overview/geo_map/embedded_map.tsx index 80aa35b297bb2..9b9a42f372022 100644 --- a/x-pack/plugins/apm/public/components/app/mobile/service_overview/geo_map/embedded_map.tsx +++ b/x-pack/plugins/apm/public/components/app/mobile/service_overview/geo_map/embedded_map.tsx @@ -130,11 +130,11 @@ function EmbeddedMapComponent({ useEffect(() => { const setLayerList = async () => { - if (embeddable && !isErrorEmbeddable(embeddable)) { + if (embeddable && !isErrorEmbeddable(embeddable) && dataView?.id) { const layerList = await getLayerList({ selectedMap, maps, - dataViewId: dataView?.id ?? '', + dataViewId: dataView.id, }); await Promise.all([ embeddable.setLayerList(layerList),