fix: avoid crash when field is deleted in Collapse

This commit is contained in:
Rain 2023-07-17 15:27:48 +08:00
parent 62381e5953
commit 4e84b14bc7
2 changed files with 2 additions and 2 deletions

View File

@ -980,7 +980,7 @@ export const useAssociationFilterBlockProps = () => {
const fieldSchema = useFieldSchema();
const optionalFieldList = useOptionalFieldList();
const { getDataBlocks } = useFilterBlock();
const collectionFieldName = collectionField.name;
const collectionFieldName = collectionField?.name;
const field = useField();
let list, handleSearchInput, params, run, data, valueKey, labelKey, filterKey;

View File

@ -29,7 +29,7 @@ export const useCollection = () => {
return {
...collection,
resource,
getField(name: SchemaKey): CollectionFieldOptions | null {
getField(name: SchemaKey): CollectionFieldOptions | undefined {
const fields = totalFields as any[];
return fields?.find((field) => field.name === name);
},