From 4afea27fa526c1bb6a95d7c2f842627e0f497a32 Mon Sep 17 00:00:00 2001 From: SiriusXT <1160925501@qq.com> Date: Mon, 17 Nov 2025 21:00:27 +0800 Subject: [PATCH] fix(tab_manager): correct order when reopening tabs --- apps/client/src/widgets/tab_row.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/client/src/widgets/tab_row.ts b/apps/client/src/widgets/tab_row.ts index c2405aaed..b78952faf 100644 --- a/apps/client/src/widgets/tab_row.ts +++ b/apps/client/src/widgets/tab_row.ts @@ -820,12 +820,15 @@ export default class TabRowWidget extends BasicWidget { } contextsReopenedEvent({ mainNtxId, tabPosition }: EventData<"contextsReopened">) { - if (!mainNtxId || !tabPosition) { + if (!mainNtxId || tabPosition < 0) { // no tab reopened return; } const tabEl = this.getTabById(mainNtxId)[0]; - tabEl.parentNode?.insertBefore(tabEl, this.tabEls[tabPosition]); + + if ( tabEl && tabEl.parentNode ){ + tabEl.parentNode.insertBefore(tabEl, this.tabEls[tabPosition]); + } } updateTabById(ntxId: string | null) {