@@ -35,7 +35,9 @@ export function VTabBar({ tabs, activeTabId, width, className, onSelectTab, onCl
3535 const [ dragTabId , setDragTabId ] = useState < string | null > ( null ) ;
3636 const [ dropIndex , setDropIndex ] = useState < number | null > ( null ) ;
3737 const [ dropLineTop , setDropLineTop ] = useState < number | null > ( null ) ;
38+ const [ hoverResetVersion , setHoverResetVersion ] = useState ( 0 ) ;
3839 const dragSourceRef = useRef < string | null > ( null ) ;
40+ const didResetHoverForDragRef = useRef ( false ) ;
3941
4042 useEffect ( ( ) => {
4143 setOrderedTabs ( tabs ) ;
@@ -44,6 +46,10 @@ export function VTabBar({ tabs, activeTabId, width, className, onSelectTab, onCl
4446 const barWidth = useMemo ( ( ) => clampWidth ( width ) , [ width ] ) ;
4547
4648 const clearDragState = ( ) => {
49+ if ( dragSourceRef . current != null && ! didResetHoverForDragRef . current ) {
50+ didResetHoverForDragRef . current = true ;
51+ setHoverResetVersion ( ( version ) => version + 1 ) ;
52+ }
4753 dragSourceRef . current = null ;
4854 setDragTabId ( null ) ;
4955 setDropIndex ( null ) ;
@@ -95,7 +101,7 @@ export function VTabBar({ tabs, activeTabId, width, className, onSelectTab, onCl
95101 >
96102 { orderedTabs . map ( ( tab , index ) => (
97103 < VTab
98- key = { tab . id }
104+ key = { ` ${ tab . id } : ${ hoverResetVersion } ` }
99105 tab = { tab }
100106 active = { tab . id === activeTabId }
101107 isDragging = { dragTabId === tab . id }
@@ -104,6 +110,7 @@ export function VTabBar({ tabs, activeTabId, width, className, onSelectTab, onCl
104110 onClose = { onCloseTab ? ( ) => onCloseTab ( tab . id ) : undefined }
105111 onRename = { onRenameTab ? ( newName ) => onRenameTab ( tab . id , newName ) : undefined }
106112 onDragStart = { ( event ) => {
113+ didResetHoverForDragRef . current = false ;
107114 dragSourceRef . current = tab . id ;
108115 event . dataTransfer . effectAllowed = "move" ;
109116 event . dataTransfer . setData ( "text/plain" , tab . id ) ;
0 commit comments