We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d238052 commit d2270a6Copy full SHA for d2270a6
1 file changed
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-drag-drop.ts
@@ -616,6 +616,18 @@ export function useDragDrop(options: UseDragDropOptions = {}) {
616
siblingsCacheRef.current.clear()
617
}, [])
618
619
+ useEffect(() => {
620
+ if (!isDragging) return
621
+ const container = scrollContainerRef.current
622
+ if (!container) return
623
+ const onLeave = (e: DragEvent) => {
624
+ const related = e.relatedTarget as Node | null
625
+ if (!related || !container.contains(related)) handleDragEnd()
626
+ }
627
+ container.addEventListener('dragleave', onLeave)
628
+ return () => container.removeEventListener('dragleave', onLeave)
629
+ }, [isDragging, handleDragEnd])
630
+
631
const setScrollContainer = useCallback((element: HTMLDivElement | null) => {
632
scrollContainerRef.current = element
633
0 commit comments