From d68ad47de66651763e22d6d0a7d2fc5a13a19c9f Mon Sep 17 00:00:00 2001 From: Harry Adel Date: Thu, 5 Feb 2026 02:28:00 +0200 Subject: [PATCH] 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. --- client/lib/dialogWithBoardSwimlaneList.js | 8 ++++++-- client/lib/dialogWithBoardSwimlaneListCard.js | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/client/lib/dialogWithBoardSwimlaneList.js b/client/lib/dialogWithBoardSwimlaneList.js index 0471efd88..888601a56 100644 --- a/client/lib/dialogWithBoardSwimlaneList.js +++ b/client/lib/dialogWithBoardSwimlaneList.js @@ -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) { diff --git a/client/lib/dialogWithBoardSwimlaneListCard.js b/client/lib/dialogWithBoardSwimlaneListCard.js index 77ceb968b..10421c3c1 100644 --- a/client/lib/dialogWithBoardSwimlaneListCard.js +++ b/client/lib/dialogWithBoardSwimlaneListCard.js @@ -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) {