Skip to content

Commit

Permalink
Add a next tick, and set selected node so that detailsTab saving func…
Browse files Browse the repository at this point in the history
…tion becomes available
  • Loading branch information
marcellamaki committed Apr 20, 2023
1 parent 2fd01d1 commit fcb1656
Showing 1 changed file with 31 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
:clipped-right="$isRTL"
app
>
<VBtn data-test="close" icon dark @click="handleClose">
<VBtn data-test="close" icon dark @click="handleClose()">
<Icon>clear</Icon>
</VBtn>
<VToolbarTitle>{{ modalTitle }}</VToolbarTitle>
Expand Down Expand Up @@ -116,7 +116,7 @@
</div>
</VFlex>
<VFlex shrink>
<VBtn color="primary" @click="handleClose">
<VBtn color="primary" @click="handleClose()">
{{ $tr('finishButton') }}
</VBtn>
</VFlex>
Expand Down Expand Up @@ -421,27 +421,35 @@
/* Button actions */
handleClose() {
// X button action
this.enableValidation(this.nodeIds);
let assessmentItems = this.getAssessmentItems(this.nodeIds);
assessmentItems.forEach(item => (item.question ? (item[DELAYED_VALIDATION] = false) : ''));
this.updateAssessmentItems(assessmentItems);
// reaches into Details Tab to run save of diffTracker
// before the validation pop up is executed
if (this.$refs.editView) {
this.$refs.editView.immediateSaveAll().then(() => {
// Catch uploads in progress and invalid nodes
if (this.invalidNodes.length) {
this.selected = [this.invalidNodes[0]];
this.promptInvalid = true;
} else if (this.contentNodesAreUploading(this.nodeIds)) {
this.promptUploading = true;
} else {
this.closeModal();
}
});
} else {
this.closeModal();
}
this.selected = this.nodeIds;
this.$nextTick(() => {
this.enableValidation(this.nodeIds);
let assessmentItems = this.getAssessmentItems(this.nodeIds);
assessmentItems.forEach(item =>
item.question ? (item[DELAYED_VALIDATION] = false) : ''
);
this.updateAssessmentItems(assessmentItems);
// reaches into Details Tab to run save of diffTracker
// before the validation pop up is executed
if (this.$refs.editView) {
this.$nextTick(() => {
this.$refs.editView.immediateSaveAll().then(() => {
// Catch uploads in progress and invalid nodes
if (this.invalidNodes.length) {
this.selected = [this.invalidNodes[0]];
this.promptInvalid = true;
} else if (this.contentNodesAreUploading(this.nodeIds)) {
this.promptUploading = true;
} else {
this.closeModal();
}
});
});
} else {
this.closeModal();
}
});
},
/* Creation actions */
Expand Down

0 comments on commit fcb1656

Please sign in to comment.