From 4a366e3fba93bb8bec43dc769e26a2ecb12498ac Mon Sep 17 00:00:00 2001 From: Red Adaya Date: Tue, 10 Dec 2024 11:29:43 +0800 Subject: [PATCH] fix first tab separator issue while dragging --- frontend/app/tab/tab.tsx | 5 ++--- frontend/app/tab/tabbar.tsx | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/frontend/app/tab/tab.tsx b/frontend/app/tab/tab.tsx index a787c3f36..6be59bef7 100644 --- a/frontend/app/tab/tab.tsx +++ b/frontend/app/tab/tab.tsx @@ -256,8 +256,6 @@ const Tab = memo( } if (rightAdjacentId) { - console.log("rightAdjacentId!!!!!", rightAdjacentId); - // To check if rightAdjacentElement is the active tab then do not reset opacity const rightAdjacentElement = document.querySelector( `[data-tab-id="${rightAdjacentId}"]` @@ -266,6 +264,7 @@ const Tab = memo( const separator = rightAdjacentElement.querySelector(".separator") as HTMLElement; if (!rightAdjacentElement.classList.contains("active")) { + console.log("here!!!!!"); separator.style.opacity = "1"; // Reset opacity for the right adjacent tab } } @@ -303,7 +302,7 @@ const Tab = memo( reset(); }; } else { - console.log("entered else ?????????????????????????"); + console.log("entered else ?????????????????????????", tabsSwapped); reset(); } }, [id, tabIds, isFirst, isActive, draggingId, tabsSwapped]); diff --git a/frontend/app/tab/tabbar.tsx b/frontend/app/tab/tabbar.tsx index c81a006af..c0cb58c1c 100644 --- a/frontend/app/tab/tabbar.tsx +++ b/frontend/app/tab/tabbar.tsx @@ -435,7 +435,7 @@ const TabBar = memo(({ workspace }: TabBarProps) => { // } // Update to trigger in-tab re-render - setTabsSwapped(newTabIndex); + setTabsSwapped(newTabIndex + 1); tabIds.splice(newTabIndex, 0, tabId); @@ -522,7 +522,7 @@ const TabBar = memo(({ workspace }: TabBarProps) => { } // setTabIndicesMoved([]); - setTabsSwapped(false); + setTabsSwapped(null); document.removeEventListener("mouseup", handleMouseUp); document.removeEventListener("mousemove", handleMouseMove); draggingRemovedRef.current = false;