Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lens] Stop requesting stats on Records field #92508

Merged
merged 3 commits into from
Feb 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -222,4 +224,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