diff --git a/packages/desktop-client/src/components/autocomplete/Autocomplete.tsx b/packages/desktop-client/src/components/autocomplete/Autocomplete.tsx index aa10a321826..10483817b1f 100644 --- a/packages/desktop-client/src/components/autocomplete/Autocomplete.tsx +++ b/packages/desktop-client/src/components/autocomplete/Autocomplete.tsx @@ -31,16 +31,12 @@ function findItem( strict: boolean, suggestions: T[], value: T | T['id'], -): T | null { +): T | T['id'] | null { if (strict) { const idx = suggestions.findIndex(item => item.id === value); return idx === -1 ? null : suggestions[idx]; } - if (typeof value === 'string') { - throw new Error('value can be string only if strict = false'); - } - return value; } @@ -302,7 +298,7 @@ function SingleAutocomplete({ } }} highlightedIndex={highlightedIndex} - selectedItem={selectedItem || null} + selectedItem={selectedItem instanceof Object ? selectedItem : null} itemToString={itemToString} inputValue={value} isOpen={isOpen} diff --git a/upcoming-release-notes/2207.md b/upcoming-release-notes/2207.md new file mode 100644 index 00000000000..4db717c4aed --- /dev/null +++ b/upcoming-release-notes/2207.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [MatissJanis] +--- + +Fix multi-autocomplete in rules page causing crashes