Skip to content
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 @@ -1229,6 +1229,24 @@ describe('IndexPatternDimensionEditorPanel', () => {
);
});

it('should not update when selecting the current field again', () => {
wrapper = mount(<IndexPatternDimensionEditorComponent {...defaultProps} />);

const comboBox = wrapper
.find(EuiComboBox)
.filter('[data-test-subj="indexPattern-dimension-field"]');

const option = comboBox
.prop('options')![1]
.options!.find(({ label }) => label === 'timestampLabel')!;

act(() => {
comboBox.prop('onChange')!([option]);
});

expect(setState).not.toHaveBeenCalled();
});

it('should show all operations that are not filtered out', () => {
wrapper = mount(
<IndexPatternDimensionEditorComponent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,12 @@ export function FieldSelect({
return;
}

trackUiEvent('indexpattern_dimension_field_changed');
const choice = (choices[0].value as unknown) as FieldChoice;

onChoose((choices[0].value as unknown) as FieldChoice);
if (choice.field !== selectedField) {
trackUiEvent('indexpattern_dimension_field_changed');
onChoose(choice);
}
}}
renderOption={(option, searchValue) => {
return (
Expand Down