mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
Fix edge case when dragging pinnned tabs (#1399)
This commit is contained in:
parent
898d21d1b2
commit
5fbd72b590
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user