Skip to content

Commit

Permalink
fix(settings): Fix edge case crashing org logo selection (#25275)
Browse files Browse the repository at this point in the history
Co-authored-by: Zach Waterfield <[email protected]>
  • Loading branch information
Twixes and zlwaterfield authored Sep 30, 2024
1 parent bb0342e commit 1e857f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion frontend/src/lib/hooks/useUploadFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function useUploadFiles({
}
}
uploadFiles().catch(console.error)
}, [filesToUpload])
}, [filesToUpload, onUpload, onError])

return { setFilesToUpload, filesToUpload, uploading }
}
10 changes: 6 additions & 4 deletions frontend/src/lib/lemon-ui/LemonFileInput/LemonFileInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ export const LemonFileInput = ({

const eventFiles = e.target.files
const filesArr = Array.prototype.slice.call(eventFiles)
const localFiles = multiple ? [...files, ...filesArr] : [filesArr[0]]
setFiles(localFiles)
onChange?.(localFiles)
if (filesArr.length > 0) {
const localFiles = multiple ? [...files, ...filesArr] : filesArr.slice(0, 1)
setFiles(localFiles)
onChange?.(localFiles)
}
}

const handleDrag = (e: DragEvent): void => {
Expand Down Expand Up @@ -141,7 +143,7 @@ export const LemonFileInput = ({
!alternativeDropTargetRef?.current && drag && 'FileDropTarget--active'
)}
>
<label className="text-muted inline-flex flex flow-row items-center gap-1 cursor-pointer">
<label className="text-muted inline-flex flow-row items-center gap-1 cursor-pointer">
<input
className="hidden"
type="file"
Expand Down

0 comments on commit 1e857f0

Please sign in to comment.