chore: comment

This commit is contained in:
Chareice 2023-04-03 17:21:10 +08:00
parent 87455e86c1
commit 8c7cebcc65

View File

@ -277,16 +277,22 @@ export class CollectionManagerPlugin extends Plugin {
for (const field of castArray(fields)) {
if (field.get('source')) {
const [collectionSource, fieldSource] = field.get('source').split('.');
// find original field
const collectionField = this.app.db.getCollection(collectionSource).getField(fieldSource);
const newOptions = {};
// write original field options
lodash.merge(newOptions, collectionField.options);
// merge with current field options
lodash.mergeWith(newOptions, field.get(), (objValue, srcValue) => {
if (srcValue === null) {
return objValue;
}
});
// set final options
field.set('options', newOptions);
}
}