Fix edge case when dragging pinnned tabs (#1399)

This commit is contained in:
Evan Simkowitz 2024-12-05 17:58:04 -05:00 committed by GitHub
parent 898d21d1b2
commit 5fbd72b590
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -452,9 +452,11 @@ const TabBar = memo(({ workspace }: TabBarProps) => {
let pinnedTabCount = pinnedTabIds.size; let pinnedTabCount = pinnedTabIds.size;
const draggedTabId = draggingTabDataRef.current.tabId; const draggedTabId = draggingTabDataRef.current.tabId;
const isPinned = pinnedTabIds.has(draggedTabId); 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); pinnedTabIds.add(draggedTabId);
} else if (!pinnedTabIds.has(tabIds[tabIndex - 1]) && isPinned) { } else if (isPinned && prevTabId && !pinnedTabIds.has(prevTabId)) {
pinnedTabIds.delete(draggedTabId); pinnedTabIds.delete(draggedTabId);
} }
if (pinnedTabCount != pinnedTabIds.size) { if (pinnedTabCount != pinnedTabIds.size) {