mirror of
https://github.com/actualbudget/actual.git
synced 2026-05-06 07:01:45 -05:00
🐛 (autocomplete) fix multi-autocomplete causing crashes (#2207)
This commit is contained in:
committed by
GitHub
parent
e792afb1fd
commit
3eee0b11d2
@@ -31,16 +31,12 @@ function findItem<T extends Item>(
|
||||
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<T extends Item>({
|
||||
}
|
||||
}}
|
||||
highlightedIndex={highlightedIndex}
|
||||
selectedItem={selectedItem || null}
|
||||
selectedItem={selectedItem instanceof Object ? selectedItem : null}
|
||||
itemToString={itemToString}
|
||||
inputValue={value}
|
||||
isOpen={isOpen}
|
||||
|
||||
6
upcoming-release-notes/2207.md
Normal file
6
upcoming-release-notes/2207.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [MatissJanis]
|
||||
---
|
||||
|
||||
Fix multi-autocomplete in rules page causing crashes
|
||||
Reference in New Issue
Block a user