diff --git a/packages/plugins/@hera/plugin-core/src/client/schema-components/auto-complete/AutoComplete.tsx b/packages/plugins/@hera/plugin-core/src/client/schema-components/auto-complete/AutoComplete.tsx index 4079dcc76..49f492cf3 100644 --- a/packages/plugins/@hera/plugin-core/src/client/schema-components/auto-complete/AutoComplete.tsx +++ b/packages/plugins/@hera/plugin-core/src/client/schema-components/auto-complete/AutoComplete.tsx @@ -53,7 +53,7 @@ export const AutoComplete = connect((props) => { fuzzysearch(inputValue, option[targetKey].toString())} + filterOption={(inputValue, option) => fuzzysearch(inputValue, option[targetKey]?.toString())} allowClear onSearch={onSearch} /> diff --git a/packages/plugins/@hera/plugin-core/src/client/utils.ts b/packages/plugins/@hera/plugin-core/src/client/utils.ts index a12cc5c1b..a9ae4c6bc 100644 --- a/packages/plugins/@hera/plugin-core/src/client/utils.ts +++ b/packages/plugins/@hera/plugin-core/src/client/utils.ts @@ -1,4 +1,8 @@ export function fuzzysearch(needle: string, haystack: string): boolean { + if (!needle || !haystack) { + return false; + } + const hlen = haystack.length; const nlen = needle.length; if (nlen > hlen) {