fix: undefined get

This commit is contained in:
Nathan
2025-10-30 21:08:41 +08:00
parent 66aae1653b
commit 77dbd3c2a3
15 changed files with 119 additions and 64 deletions

View File

@@ -1294,7 +1294,11 @@ export const useSelectFieldOptions = (fieldId: string, searchValue?: string) =>
if (!typeOption) return [] as SelectOption[];
return typeOption.options.filter((option) => {
const normalizedOptions = typeOption.options.filter((option): option is SelectOption => {
return Boolean(option && option.id && option.name);
});
return normalizedOptions.filter((option) => {
if (!searchValue) return true;
return option.name.toLowerCase().includes(searchValue.toLowerCase());
});