Skip to content

Commit c4b2565

Browse files
committed
Workaround: don't use form-global data for check
Note: we're balancing multiple bugs against eachother here, not ideal! - the diff doesn't catch removed Relationship fields; instead, form reload is triggered by a dspace.entity.type change - if we add the original `this.sectionMetadata.includes(key)` check, we filter out this change and the form fails to update - if we add `relation.*` fields to `this.sectionMetadata`, newly added Relationship entries are duplicated As of this commit, the form _seems_ to work in a stable way, but these issues shoud really investigated in more detail.
1 parent d4efd85 commit c4b2565

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/app/submission/sections/form/section-form.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,10 @@ export class SubmissionSectionFormComponent extends SectionModelComponent {
229229

230230
const sectionDataToCheck = {};
231231
Object.keys(sectionData).forEach((key) => {
232-
if (this.sectionData.data && hasValue(this.sectionData.data[key]) && this.inCurrentSubmissionScope(key)) {
233-
sectionDataToCheck[key] = this.sectionData.data[key];
232+
// todo: removing Relationships works due to a bug -- dspace.entity.type is included in sectionData, which is what triggers the update;
233+
// if we use this.sectionMetadata.includes(key), this field is filtered out and removed Relationships won't disappear from the form.
234+
if (this.inCurrentSubmissionScope(key)) {
235+
sectionDataToCheck[key] = sectionData[key];
234236
}
235237
});
236238

0 commit comments

Comments
 (0)