Fix: ‘Copy missing fields’ button not functioning correctly for list-type fields (#1290)
This commit is contained in:
+8
-1
@@ -533,7 +533,14 @@ export class MetadataPickerComponent implements OnInit {
|
|||||||
copyMissing(): void {
|
copyMissing(): void {
|
||||||
Object.keys(this.fetchedMetadata).forEach((field) => {
|
Object.keys(this.fetchedMetadata).forEach((field) => {
|
||||||
const isLocked = this.metadataForm.get(`${field}Locked`)?.value;
|
const isLocked = this.metadataForm.get(`${field}Locked`)?.value;
|
||||||
if (!isLocked && !this.metadataForm.get(field)?.value && this.fetchedMetadata[field]) {
|
const currentValue = this.metadataForm.get(field)?.value;
|
||||||
|
const fetchedValue = this.fetchedMetadata[field];
|
||||||
|
|
||||||
|
const isEmpty = Array.isArray(currentValue)
|
||||||
|
? currentValue.length === 0
|
||||||
|
: !currentValue;
|
||||||
|
|
||||||
|
if (!isLocked && isEmpty && fetchedValue) {
|
||||||
this.copyFetchedToCurrent(field);
|
this.copyFetchedToCurrent(field);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user