fix: load field when source collection not found

This commit is contained in:
Chareice 2023-12-06 09:45:32 +08:00
parent 16ad19b18d
commit 95bec2278f
No known key found for this signature in database

View File

@ -298,16 +298,16 @@ export class Collection<
this.db.logger.warn(
`source collection "${sourceCollectionName}" not found for field "${name}" at collection "${this.name}"`,
);
}
const sourceField = sourceCollection.fields.get(sourceFieldName);
if (!sourceField) {
this.db.logger.warn(
`source field "${sourceFieldName}" not found for field "${name}" at collection "${this.name}"`,
);
} else {
options = { ...lodash.omit(sourceField.options, ['name', 'primaryKey']), ...options };
const sourceField = sourceCollection.fields.get(sourceFieldName);
if (!sourceField) {
this.db.logger.warn(
`source field "${sourceFieldName}" not found for field "${name}" at collection "${this.name}"`,
);
} else {
options = { ...lodash.omit(sourceField.options, ['name', 'primaryKey']), ...options };
}
}
}