Skip to content

Commit eeac356

Browse files
authored
fix: change prop type for abbreviations to map (argoproj#163)
Signed-off-by: saumeya <[email protected]>
1 parent e1a1cc1 commit eeac356

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

v2/components/autocomplete/autocomplete.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const useAutocomplete = (init: string): [string, SetInputFxn, Autocomplet
2323
export const Autocomplete = (
2424
props: React.InputHTMLAttributes<HTMLInputElement> & {
2525
items: string[];
26-
abbreviations?: { [key: string]: string };
26+
abbreviations?: Map<string, string>;
2727
inputStyle?: React.CSSProperties;
2828
onItemClick?: (item: string) => void;
2929
icon?: string;
@@ -40,7 +40,7 @@ export const Autocomplete = (
4040
export const RenderAutocomplete = (
4141
props: React.InputHTMLAttributes<HTMLInputElement> & {
4242
items: string[];
43-
abbreviations?: { [key: string]: string };
43+
abbreviations?: Map<string, string>;
4444
inputStyle?: React.CSSProperties;
4545
onItemClick?: (item: string) => void;
4646
icon?: string;
@@ -73,7 +73,7 @@ export const RenderAutocomplete = (
7373
const filtered = (props.items || []).filter((i) => {
7474
if (i) {
7575
return props.abbreviations !== undefined
76-
? i.toLowerCase().includes(debouncedVal?.toLowerCase()) || props.abbreviations[i]?.includes(debouncedVal?.toLowerCase())
76+
? i.toLowerCase().includes(debouncedVal?.toLowerCase()) || props.abbreviations.get(i)?.includes(debouncedVal?.toLowerCase())
7777
: i.toLowerCase().includes(debouncedVal?.toLowerCase());
7878
}
7979
return false;

0 commit comments

Comments
 (0)