From 8a535cfd47d4c32088ba9ddf45b58a80c56d8d0a Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Wed, 11 Sep 2019 16:14:52 +0200 Subject: [PATCH] Convert value provided to PhraseValueInput to string to catch Exception (#45259) (#45365) --- .../filter/filter_bar/filter_editor/phrase_value_input.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/phrase_value_input.tsx b/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/phrase_value_input.tsx index f33ce3d7486f..0696bacc568b 100644 --- a/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/phrase_value_input.tsx +++ b/src/legacy/core_plugins/data/public/filter/filter_bar/filter_editor/phrase_value_input.tsx @@ -60,7 +60,9 @@ class PhraseValueInputUI extends PhraseSuggestor { private renderWithSuggestions() { const { suggestions } = this.state; const { value, intl, onChange } = this.props; - const options = value ? uniq([value, ...suggestions]) : suggestions; + // there are cases when the value is a number, this would cause an exception + const valueAsStr = String(value); + const options = value ? uniq([valueAsStr, ...suggestions]) : suggestions; return ( { })} options={options} getLabel={option => option} - selectedOptions={value ? [value] : []} + selectedOptions={value ? [valueAsStr] : []} onChange={([newValue = '']) => onChange(newValue)} onSearchChange={this.onSearchChange} singleSelection={{ asPlainText: true }}