Skip to content

Commit 3053851

Browse files
Wylie Conlonkibanamachine
authored andcommitted
[Lens] Stop requesting stats on Records field (#92508)
Co-authored-by: Kibana Machine <[email protected]>
1 parent 179f6cb commit 3053851

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

x-pack/plugins/lens/public/indexpattern_datasource/field_item.test.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { DataPublicPluginStart } from '../../../../../src/plugins/data/public';
1616
import { dataPluginMock } from '../../../../../src/plugins/data/public/mocks';
1717
import { IndexPattern } from './types';
1818
import { chartPluginMock } from '../../../../../src/plugins/charts/public/mocks';
19+
import { documentField } from './document_field';
1920

2021
const chartsThemeService = chartPluginMock.createSetupContract().theme;
2122

@@ -70,6 +71,7 @@ describe('IndexPattern Field Item', () => {
7071
aggregatable: true,
7172
searchable: true,
7273
},
74+
documentField,
7375
],
7476
} as IndexPattern;
7577

@@ -263,4 +265,14 @@ describe('IndexPattern Field Item', () => {
263265
}
264266
);
265267
});
268+
269+
it('should not request field stats for document field', async () => {
270+
const wrapper = mountWithIntl(<InnerFieldItem {...defaultProps} field={documentField} />);
271+
272+
clickField(wrapper, 'Records');
273+
274+
expect(core.http.post).not.toHaveBeenCalled();
275+
expect(wrapper.find(EuiPopover).prop('isOpen')).toEqual(true);
276+
expect(wrapper.find(EuiLoadingSpinner)).toHaveLength(0);
277+
});
266278
});

x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export const InnerFieldItem = function InnerFieldItem(props: FieldItemProps) {
122122
});
123123

124124
function fetchData() {
125-
if (state.isLoading) {
125+
if (state.isLoading || field.type === 'document') {
126126
return;
127127
}
128128

0 commit comments

Comments
 (0)