Skip to content

Commit

Permalink
[APM] Fix mobile geo map (elastic#174846)
Browse files Browse the repository at this point in the history
  • Loading branch information
kpatticha authored Jan 16, 2024
1 parent d804f4e commit 5a73250
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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(
<MemoryRouter
initialEntries={[
Expand All @@ -52,6 +64,7 @@ describe('Embedded Map', () => {
filters={[]}
start="2022-12-20T10:00:00.000Z"
end="2022-12-20T10:15:00.000Z"
dataView={mockDataView}
/>
</KibanaContextProvider>
</MockApmPluginContextWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 5a73250

Please sign in to comment.