mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 10:34:15 +00:00
Fixed issue with a subscribiption when submission component is destroyed
This commit is contained in:
@@ -615,7 +615,7 @@ function changeSectionState(state: SubmissionObjectState, action: EnableSectionA
|
|||||||
* the new state, with the section new validity status.
|
* the new state, with the section new validity status.
|
||||||
*/
|
*/
|
||||||
function setIsValid(state: SubmissionObjectState, action: SectionStatusChangeAction): SubmissionObjectState {
|
function setIsValid(state: SubmissionObjectState, action: SectionStatusChangeAction): SubmissionObjectState {
|
||||||
if (hasValue(state[ action.payload.submissionId ].sections[ action.payload.sectionId ])) {
|
if (isNotEmpty(state[ action.payload.submissionId ]) && hasValue(state[ action.payload.submissionId ].sections[ action.payload.sectionId ])) {
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
[ action.payload.submissionId ]: Object.assign({}, state[ action.payload.submissionId ], {
|
[ action.payload.submissionId ]: Object.assign({}, state[ action.payload.submissionId ], {
|
||||||
sections: Object.assign({}, state[ action.payload.submissionId ].sections,
|
sections: Object.assign({}, state[ action.payload.submissionId ].sections,
|
||||||
|
@@ -74,7 +74,6 @@ export class LicenseSectionComponent extends SectionModelComponent {
|
|||||||
// Retrieve license accepted status
|
// Retrieve license accepted status
|
||||||
if ((this.sectionData.data as WorkspaceitemSectionLicenseObject).granted) {
|
if ((this.sectionData.data as WorkspaceitemSectionLicenseObject).granted) {
|
||||||
(model as DynamicCheckboxModel).valueUpdates.next(true);
|
(model as DynamicCheckboxModel).valueUpdates.next(true);
|
||||||
// this.sectionService.setSectionStatus(this.submissionId, this.sectionData.id, true);
|
|
||||||
} else {
|
} else {
|
||||||
(model as DynamicCheckboxModel).valueUpdates.next(false);
|
(model as DynamicCheckboxModel).valueUpdates.next(false);
|
||||||
}
|
}
|
||||||
@@ -130,7 +129,6 @@ export class LicenseSectionComponent extends SectionModelComponent {
|
|||||||
onChange(event: DynamicFormControlEvent) {
|
onChange(event: DynamicFormControlEvent) {
|
||||||
const path = this.formOperationsService.getFieldPathSegmentedFromChangeEvent(event);
|
const path = this.formOperationsService.getFieldPathSegmentedFromChangeEvent(event);
|
||||||
const value = this.formOperationsService.getFieldValueFromChangeEvent(event);
|
const value = this.formOperationsService.getFieldValueFromChangeEvent(event);
|
||||||
// this.sectionService.setSectionStatus(this.submissionId, this.sectionData.id, value.value);
|
|
||||||
if (value) {
|
if (value) {
|
||||||
this.operationsBuilder.add(this.pathCombiner.getPath(path), value.value.toString(), false, true);
|
this.operationsBuilder.add(this.pathCombiner.getPath(path), value.value.toString(), false, true);
|
||||||
// Remove any section's errors
|
// Remove any section's errors
|
||||||
|
@@ -47,9 +47,9 @@ export abstract class SectionModelComponent implements OnDestroy, OnInit, Sectio
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.onSectionDestroy();
|
|
||||||
if (hasValue(this.sectionStatusSub)) {
|
if (hasValue(this.sectionStatusSub)) {
|
||||||
this.sectionStatusSub.unsubscribe();
|
this.sectionStatusSub.unsubscribe();
|
||||||
}
|
}
|
||||||
|
this.onSectionDestroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user