From b0835a92b747b02f0c3e100f79f2afac9b874373 Mon Sep 17 00:00:00 2001 From: Wylie Conlon Date: Tue, 23 Feb 2021 14:51:30 -0500 Subject: [PATCH] [Lens] Stop requesting stats on Records field --- .../indexpattern_datasource/field_item.test.tsx | 12 ++++++++++++ .../public/indexpattern_datasource/field_item.tsx | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx index 0871ef47494960..99b571af964fba 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx @@ -16,6 +16,7 @@ import { DataPublicPluginStart } from '../../../../../src/plugins/data/public'; import { dataPluginMock } from '../../../../../src/plugins/data/public/mocks'; import { IndexPattern } from './types'; import { chartPluginMock } from '../../../../../src/plugins/charts/public/mocks'; +import { documentField } from './document_field'; const chartsThemeService = chartPluginMock.createSetupContract().theme; @@ -70,6 +71,7 @@ describe('IndexPattern Field Item', () => { aggregatable: true, searchable: true, }, + documentField, ], } as IndexPattern; @@ -222,4 +224,14 @@ describe('IndexPattern Field Item', () => { }), }); }); + + it('should not request field stats for document field', async () => { + const wrapper = mountWithIntl(); + + clickField(wrapper, 'Records'); + + expect(core.http.post).not.toHaveBeenCalled(); + expect(wrapper.find(EuiPopover).prop('isOpen')).toEqual(true); + expect(wrapper.find(EuiLoadingSpinner)).toHaveLength(0); + }); }); diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx index e5d46b4a7a0737..09510f05ad1808 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx @@ -122,7 +122,7 @@ export const InnerFieldItem = function InnerFieldItem(props: FieldItemProps) { }); function fetchData() { - if (state.isLoading) { + if (state.isLoading || field.type === 'document') { return; }