Await async setDone before closing popup in copy/move dialogs

The click handler called setDone() without await then immediately
called Popup.back(2), destroying the popup template while the async
operation was still running. This caused unhandled promise rejections
and made errors invisible to the user.
This commit is contained in:
Harry Adel 2026-02-05 02:28:00 +02:00
parent bb12311e2f
commit d68ad47de6
2 changed files with 12 additions and 4 deletions

View file

@ -186,7 +186,7 @@ export class DialogWithBoardSwimlaneList extends BlazeComponent {
events() {
return [
{
'click .js-done'() {
async 'click .js-done'() {
const boardSelect = this.$('.js-select-boards')[0];
const boardId = boardSelect.options[boardSelect.selectedIndex].value;
@ -201,7 +201,11 @@ export class DialogWithBoardSwimlaneList extends BlazeComponent {
'swimlaneId' : swimlaneId,
'listId' : listId,
}
this.setDone(boardId, swimlaneId, listId, options);
try {
await this.setDone(boardId, swimlaneId, listId, options);
} catch (e) {
console.error('Error in list dialog operation:', e);
}
Popup.back(2);
},
'change .js-select-boards'(event) {

View file

@ -80,7 +80,7 @@ export class DialogWithBoardSwimlaneListCard extends DialogWithBoardSwimlaneList
events() {
return [
{
'click .js-done'() {
async 'click .js-done'() {
const boardSelect = this.$('.js-select-boards')[0];
const boardId = boardSelect.options[boardSelect.selectedIndex].value;
@ -99,7 +99,11 @@ export class DialogWithBoardSwimlaneListCard extends DialogWithBoardSwimlaneList
'listId' : listId,
'cardId': cardId,
}
this.setDone(cardId, options);
try {
await this.setDone(cardId, options);
} catch (e) {
console.error('Error in card dialog operation:', e);
}
Popup.back(2);
},
'change .js-select-boards'(event) {