From 5826a09ef64c15ce385cc6c89063a9a7250e509c Mon Sep 17 00:00:00 2001 From: Wylie Conlon Date: Thu, 3 Dec 2020 13:40:22 -0500 Subject: [PATCH] [Lens] Fix error when selecting the current field again (#84817) --- .../dimension_panel/dimension_panel.test.tsx | 18 ++++++++++++++++++ .../dimension_panel/field_select.tsx | 7 +++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx index dbfffb5c2bd59..450918f1d13f2 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/dimension_panel/dimension_panel.test.tsx @@ -1229,6 +1229,24 @@ describe('IndexPatternDimensionEditorPanel', () => { ); }); + it('should not update when selecting the current field again', () => { + wrapper = mount(); + + 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( { return (