From 0858f531e4e6bf35e4a5ac0ec83777705a855e40 Mon Sep 17 00:00:00 2001 From: Jin <22962980+JYC333@users.noreply.github.com> Date: Wed, 5 Mar 2025 13:40:58 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20can't=20move=20a=20tab=20?= =?UTF-8?q?to=20new=20window?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/app/components/tab_manager.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/public/app/components/tab_manager.ts b/src/public/app/components/tab_manager.ts index f222a4655..8906d496a 100644 --- a/src/public/app/components/tab_manager.ts +++ b/src/public/app/components/tab_manager.ts @@ -393,17 +393,17 @@ export default class TabManager extends Component { this.setCurrentNavigationStateToHash(); } - async removeNoteContext(ntxId: string | null) { + async removeNoteContext(ntxId: string | null): Promise { // removing note context is an async process which can take some time, if users presses CTRL-W quickly, two // close events could interleave which would then lead to attempting to activate already removed context. - return await this.mutex.runExclusively(async () => { + return await this.mutex.runExclusively(async (): Promise => { let noteContextToRemove; try { noteContextToRemove = this.getNoteContextById(ntxId); } catch { // note context not found - return; + return false; } if (noteContextToRemove.isMainContext()) { @@ -413,7 +413,7 @@ export default class TabManager extends Component { if (noteContextToRemove.isEmpty()) { // this is already the empty note context, no point in closing it and replacing with another // empty tab - return; + return false; } await this.openEmptyTab(); @@ -451,6 +451,7 @@ export default class TabManager extends Component { } this.removeNoteContexts(noteContextsToRemove); + return true; }); }