From 70c009ad4be795a74a83348abdfd84d5f8ec74a7 Mon Sep 17 00:00:00 2001 From: Brace Sproul Date: Wed, 28 May 2025 13:06:38 -0700 Subject: [PATCH] fix: Pull latest for chat ui (#36) * fix: Pull latest for chat ui * cr --- apps/web/src/hooks/use-file-upload.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/web/src/hooks/use-file-upload.tsx b/apps/web/src/hooks/use-file-upload.tsx index 664de4a2..36d395cd 100644 --- a/apps/web/src/hooks/use-file-upload.tsx +++ b/apps/web/src/hooks/use-file-upload.tsx @@ -86,13 +86,13 @@ export function useFileUpload({ // Global drag events with counter for robust dragOver state const handleWindowDragEnter = (e: DragEvent) => { if (e.dataTransfer?.types?.includes("Files")) { - dragCounter.current++; + dragCounter.current += 1; setDragOver(true); } }; const handleWindowDragLeave = (e: DragEvent) => { if (e.dataTransfer?.types?.includes("Files")) { - dragCounter.current--; + dragCounter.current -= 1; if (dragCounter.current <= 0) { setDragOver(false); dragCounter.current = 0; @@ -200,18 +200,20 @@ export function useFileUpload({ const handlePaste = async ( e: React.ClipboardEvent, ) => { - e.preventDefault(); const items = e.clipboardData.items; if (!items) return; const files: File[] = []; - for (let i = 0; i < items.length; i++) { + for (let i = 0; i < items.length; i += 1) { const item = items[i]; if (item.kind === "file") { const file = item.getAsFile(); if (file) files.push(file); } } - if (files.length === 0) return; + if (files.length === 0) { + return; + } + e.preventDefault(); const validFiles = files.filter((file) => SUPPORTED_FILE_TYPES.includes(file.type), );