fix(transactions): Mirror create's file-upload step on edit #79
Merged
Conversation
Creating a transaction routed picked files through the dedicated multipart upload endpoint. Editing a transaction accepted files in the form but never uploaded them, so attachments added during an edit silently disappeared. The update flow now performs the same upload step, so files added on edit actually land on the transaction.
Attachments only appeared as filename chips: picked images had no thumbnail, saved attachments were invisible during edit, and reopening the picker replaced the previous selection instead of extending it. Picked attachments now render as cards with image thumbnails or a label tile for documents, successive picks append to the selection, and saved attachments load through the auth-gated file endpoint with a per-file remove control that deletes them from the transaction.
Code Review SummaryThis PR successfully implements a robust file-upload mirroring for the edit state. It introduces image previews, file type labeling, and a clean management of attachment lifecycle (upload/delete). 🚀 Key Improvements
💡 Minor Suggestions
|
Deploying webui with
|
| Latest commit: |
697e407
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2f315ef0.webui-9fh.pages.dev |
| Branch Preview URL: | https://fix-transaction-file-upload.webui-9fh.pages.dev |
Deploying trakli-dev with
|
| Latest commit: |
697e407
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6b989e22.trakli-dev.pages.dev |
| Branch Preview URL: | https://fix-transaction-file-upload.trakli-dev.pages.dev |
The "Max 5 files" hint was advisory only -- the picker happily added more than five attachments, leaving the count to be rejected later by the server. The form now silently drops anything past five total attachments (counting both saved and newly picked files), matching the hint.
|
|
||
| function extensionLabel(name: string): string { | ||
| const cleaned = (name || '').split('?')[0].split('#')[0]; | ||
| const ext = cleaned.split('.').pop(); |
There was a problem hiding this comment.
The logic for extracting the file extension might fail if the filename contains special characters or lacks an extension. Using lastIndexOf('.') is more robust than multiple splits.
Suggested change
| const ext = cleaned.split('.').pop(); | |
| const ext = name.includes('.') ? name.split('.').pop() : 'FILE'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.