Handle cases where the copy note dialog is closed via Cancel actions and
emits no data.
Also be sure the dialog emits consistently shaped data when it does emit
data.
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
this.copyNotesDialog.copyIds = this.context.copyList().map(c => c.id());
this.copyNotesDialog.open({size: 'lg'}).subscribe(changes => {
+ if (!changes) { return; }
+
if ((!changes.newNotes || changes.newNotes.length === 0) &&
(!changes.delNotes || changes.delNotes.length === 0)
) {
this.copyNotesDialog.copyIds = copyIds;
this.copyNotesDialog.open({size: 'lg'}).subscribe(
changes => {
+ if (!changes) { return; }
if (changes.newNotes.length > 0 || changes.delNotes.length > 0) {
this.hardRefresh();
}
}
}).then(_ => {
this.successMsg.current().then(msg => this.toast.success(msg));
- this.close(this.newNotes.length > 0 || this.delNotes.length > 0);
+ this.close({ newNotes: this.newNotes, delNotes: this.delNotes });
});
}
}