Skip to content

Commit

Permalink
[Lens] Stop requesting stats on Records field (#92508) (#92628)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
Wylie Conlon and kibanamachine committed Feb 24, 2021
1 parent a0b8fa7 commit 416e397
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -70,6 +71,7 @@ describe('IndexPattern Field Item', () => {
aggregatable: true,
searchable: true,
},
documentField,
],
} as IndexPattern;

Expand Down Expand Up @@ -263,4 +265,14 @@ describe('IndexPattern Field Item', () => {
}
);
});

it('should not request field stats for document field', async () => {
const wrapper = mountWithIntl(<InnerFieldItem {...defaultProps} field={documentField} />);

clickField(wrapper, 'Records');

expect(core.http.post).not.toHaveBeenCalled();
expect(wrapper.find(EuiPopover).prop('isOpen')).toEqual(true);
expect(wrapper.find(EuiLoadingSpinner)).toHaveLength(0);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const InnerFieldItem = function InnerFieldItem(props: FieldItemProps) {
});

function fetchData() {
if (state.isLoading) {
if (state.isLoading || field.type === 'document') {
return;
}

Expand Down

0 comments on commit 416e397

Please sign in to comment.