Skip to content

Commit 4afea27

Browse files
committed
fix(tab_manager): correct order when reopening tabs
1 parent be19d1f commit 4afea27

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

apps/client/src/widgets/tab_row.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,12 +820,15 @@ export default class TabRowWidget extends BasicWidget {
820820
}
821821

822822
contextsReopenedEvent({ mainNtxId, tabPosition }: EventData<"contextsReopened">) {
823-
if (!mainNtxId || !tabPosition) {
823+
if (!mainNtxId || tabPosition < 0) {
824824
// no tab reopened
825825
return;
826826
}
827827
const tabEl = this.getTabById(mainNtxId)[0];
828-
tabEl.parentNode?.insertBefore(tabEl, this.tabEls[tabPosition]);
828+
829+
if ( tabEl && tabEl.parentNode ){
830+
tabEl.parentNode.insertBefore(tabEl, this.tabEls[tabPosition]);
831+
}
829832
}
830833

831834
updateTabById(ntxId: string | null) {

0 commit comments

Comments
 (0)