Fix issue relation loosing extra options on ctb update Fixes #3409 (#10102)

This commit is contained in:
Alexandre BODIN 2021-04-27 03:05:43 +12:00 committed by GitHub
parent 11a128ead2
commit 196b0895f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -158,7 +158,8 @@ module.exports = function createComponentBuilder() {
this.unsetRelation(oldAttribute);
}
newAttribute.autoPopulate = newAttribute.autoPopulate || oldAttribute.autoPopulate;
// keep extra options that were set manually on oldAttribute
_.defaults(newAttribute, oldAttribute);
return this.setRelation({
key,

View File

@ -115,8 +115,8 @@ function createSchemaBuilder({ components, contentTypes }) {
targetAttribute,
columnName,
dominant,
autoPopulate,
private: isPrivate,
...restOfOptions
} = attribute;
const attr = {
@ -124,7 +124,7 @@ function createSchemaBuilder({ components, contentTypes }) {
columnName: columnName || undefined,
configurable: configurable === false ? false : undefined,
private: isPrivate === true ? true : undefined,
autoPopulate,
...restOfOptions,
};
if (!this.contentTypes.has(target)) {