Fix: ‘Copy missing fields’ button not functioning correctly for list-type fields (#1290)

This commit is contained in:
Aditya Chandel
2025-10-07 14:20:23 -06:00
committed by GitHub
parent 16dc36c796
commit 7b37d381af
@@ -533,7 +533,14 @@ export class MetadataPickerComponent implements OnInit {
copyMissing(): void {
Object.keys(this.fetchedMetadata).forEach((field) => {
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);
}
});