From 95bec2278ff2f53dfb1307e47bc8aca90d5a606a Mon Sep 17 00:00:00 2001 From: Chareice Date: Wed, 6 Dec 2023 09:45:32 +0800 Subject: [PATCH] fix: load field when source collection not found --- packages/core/database/src/collection.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/core/database/src/collection.ts b/packages/core/database/src/collection.ts index f112bb285..ceecfc848 100644 --- a/packages/core/database/src/collection.ts +++ b/packages/core/database/src/collection.ts @@ -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 }; + } } }