From 5fbd72b5900f2a6a7f5072d0a288816fb5d71a56 Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Thu, 5 Dec 2024 17:58:04 -0500 Subject: [PATCH] Fix edge case when dragging pinnned tabs (#1399) --- frontend/app/tab/tabbar.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/app/tab/tabbar.tsx b/frontend/app/tab/tabbar.tsx index 0b3891ae9..be3994bc6 100644 --- a/frontend/app/tab/tabbar.tsx +++ b/frontend/app/tab/tabbar.tsx @@ -452,9 +452,11 @@ const TabBar = memo(({ workspace }: TabBarProps) => { let pinnedTabCount = pinnedTabIds.size; const draggedTabId = draggingTabDataRef.current.tabId; const isPinned = pinnedTabIds.has(draggedTabId); - if (pinnedTabIds.has(tabIds[tabIndex + 1]) && !isPinned) { + const nextTabId = tabIds[tabIndex + 1]; + const prevTabId = tabIds[tabIndex - 1]; + if (!isPinned && nextTabId && pinnedTabIds.has(nextTabId)) { pinnedTabIds.add(draggedTabId); - } else if (!pinnedTabIds.has(tabIds[tabIndex - 1]) && isPinned) { + } else if (isPinned && prevTabId && !pinnedTabIds.has(prevTabId)) { pinnedTabIds.delete(draggedTabId); } if (pinnedTabCount != pinnedTabIds.size) {