Remove auto-save to allow manual editing before persistence - #6
Conversation
Co-authored-by: Rikul <1149512+Rikul@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| lineItems: [] | ||
| }; | ||
| // We need the image even if analysis failed to initialize the record | ||
| if (image) initializeRecord(emptyData, image); | ||
| if (resizedImage) initializeRecord(emptyData, resizedImage); |
There was a problem hiding this comment.
@copilot
Handle analysis failures without crashing
When the receipt analysis or resize fails, the catch block tries to call initializeRecord with resizedImage, but that identifier is only declared inside the preceding try block and is out of scope here. As soon as the catch executes, React will throw a ReferenceError instead of showing the manual entry fallback, leaving users stuck whenever extraction fails. Declare the resized image in a shared scope or use the already stored image state when handling errors.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
![P1 Badge (https://camo.githubusercontent.com/c595229c0ecb6ee85b9c7804144d495f131a495ec87091fea2b262d954c9a92d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50312d6f72616e67653f7374796c653d666c6174) Handle analysis failures without crashing
When the receipt analysis or resize fails, the catch block tries to call
initializeRecordwithresizedImage, but that identifier is only declared inside the precedingtryblock and is out of scope here. As soon as the catch executes, React will throw aReferenceErrorinstead of showing the manual entry fallback, leaving users stuck whenever extraction fails. Declare the resized image in a shared scope or use the already storedimagestate when handling errors.Useful? React with 👍 / 👎.
AI models sometimes fail to parse receipt fields correctly. With auto-save, malformed data gets persisted immediately, preventing users from correcting it.
Changes
initializeRecordupdateFieldresizedImageinstead of unsetimagein error handlerBefore/After
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.