mirror of
https://github.com/AppFlowy-IO/AppFlowy-Web.git
synced 2025-11-30 03:18:02 +08:00
fix: Handle missing select options and async relation view lookups
This commit is contained in:
@@ -1294,13 +1294,14 @@ export const useSelectFieldOptions = (fieldId: string, searchValue?: string) =>
|
||||
|
||||
if (!typeOption) return [] as SelectOption[];
|
||||
|
||||
const normalizedOptions = typeOption.options.filter((option): option is SelectOption => {
|
||||
return Boolean(option && option.id && option.name);
|
||||
const normalizedOptions = typeOption.options.filter((option) => {
|
||||
return Boolean(option && option.id);
|
||||
});
|
||||
|
||||
return normalizedOptions.filter((option) => {
|
||||
const optionName = typeof option.name === 'string' ? option.name : '';
|
||||
if (!searchValue) return true;
|
||||
return option.name.toLowerCase().includes(searchValue.toLowerCase());
|
||||
return optionName.toLowerCase().includes(searchValue.toLowerCase());
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [field, searchValue, clock]);
|
||||
|
||||
Reference in New Issue
Block a user