Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves client-side handling of unsupported/invalid file formats during drag-and-drop uploads by surfacing react-dropzone rejection reasons to the user, and includes a Rust dependency lockfile update.
Changes:
- Add file-rejection handling in
ImageConverterto display specific rejection reasons. - Extend
DragAndDropZoneto optionally forwardreact-dropzoneonDropRejectedevents via a newonFileRejectprop. - Update
api/Cargo.lock(notablyglampatch version bump).
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| client/src/components/images/ImageConverter.tsx | Adds handleFileReject and wires it into the drop zone to report rejected file reasons. |
| client/src/components/common/DragAndDropZone.tsx | Adds an optional onFileReject prop and forwards onDropRejected callbacks from useDropzone. |
| api/Cargo.lock | Updates locked Rust dependencies (including glam 0.30.9 → 0.30.10). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -1,9 +1,10 @@ | |||
| import { useDropzone, type Accept } from 'react-dropzone'; | |||
| import { FileRejection, useDropzone, type Accept } from 'react-dropzone'; | |||
There was a problem hiding this comment.
FileRejection is a type-only export from react-dropzone; importing it as a value can produce a runtime ESM import that fails if the bundler doesn’t elide type-only imports. Import it with import type { FileRejection } (and keep the useDropzone value import separate).
| import { FileRejection, useDropzone, type Accept } from 'react-dropzone'; | |
| import { useDropzone, type Accept } from 'react-dropzone'; | |
| import type { FileRejection } from 'react-dropzone'; |
| if (onFileReject) { | ||
| onFileReject(rejectedFiles); |
There was a problem hiding this comment.
onDropAccepted is wrapped in a try/catch, but onDropRejected isn’t. If onFileReject throws (e.g., state update logic changes later), it will become an uncaught exception from the dropzone handler. Wrap the onFileReject call in the same error handling used for accepted files (and optionally log a consistent error message).
| if (onFileReject) { | |
| onFileReject(rejectedFiles); | |
| if (!onFileReject) { | |
| return; | |
| } | |
| try { | |
| onFileReject(rejectedFiles); | |
| } catch (error) { | |
| console.error('Error handling rejected files:', error); |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…/rustoscope into wrong_format_handling
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.