From 1f2c4ec56990c2ca04fca9e16b8b6adc42ca0e5e Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sat, 30 May 2026 11:35:17 -0700 Subject: [PATCH] Cancel file explorer drag scroll in global cleanup (#3473) --- .../src/components/right-sidebar/useFileExplorerDragDrop.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/renderer/src/components/right-sidebar/useFileExplorerDragDrop.ts b/src/renderer/src/components/right-sidebar/useFileExplorerDragDrop.ts index eaac00495..c4f932cc9 100644 --- a/src/renderer/src/components/right-sidebar/useFileExplorerDragDrop.ts +++ b/src/renderer/src/components/right-sidebar/useFileExplorerDragDrop.ts @@ -123,8 +123,6 @@ export function useFileExplorerDragDrop({ } }, []) - useEffect(() => () => stopDragEdgeScroll(), [stopDragEdgeScroll]) - const clearDragState = useCallback(() => { rootDragCounterRef.current = 0 nativeRootDragCounterRef.current = 0 @@ -153,11 +151,12 @@ export function useFileExplorerDragDrop({ window.addEventListener('blur', handleGlobalDragFinish) return () => { + stopDragEdgeScroll() document.removeEventListener('drop', handleGlobalDragFinish, true) document.removeEventListener('dragend', handleGlobalDragFinish, true) window.removeEventListener('blur', handleGlobalDragFinish) } - }, [stopAndClearDragState]) + }, [stopAndClearDragState, stopDragEdgeScroll]) // requestAnimationFrame + small per-frame deltas avoids choppy jumps from irregular dragover events const tickDragEdgeScroll = useCallback(() => {