Skip to content

Remove auto-save to allow manual editing before persistence - #6

Merged
Rikul merged 2 commits into
mainfrom
copilot/remove-auto-save-feature
Nov 26, 2025
Merged

Remove auto-save to allow manual editing before persistence#6
Rikul merged 2 commits into
mainfrom
copilot/remove-auto-save-feature

Conversation

Copilot AI commented Nov 26, 2025

Copy link
Copy Markdown
Contributor

AI models sometimes fail to parse receipt fields correctly. With auto-save, malformed data gets persisted immediately, preventing users from correcting it.

Changes

  • Remove immediate save after AI extraction in initializeRecord
  • Remove save-on-change in updateField
  • Replace "Done" with explicit "Save" button
  • Remove "Autosave On" indicator
  • Add save error feedback UI
  • Fix bug: use resizedImage instead of unset image in error handler

Before/After

// Before: auto-save on every change
const updateField = (field: keyof BillData, value: any) => {
  setData(newData);
  saveBill({...newData, id: recordId, ...});  // immediate persist
};

// After: explicit save only
const updateField = (field: keyof BillData, value: any) => {
  setData(newData);  // local state only
};

Upload page

Original prompt

sometimes the models cant parse the fields but because of auto save, I cant edit it and it gets saved. so remove the auto save


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Rikul <1149512+Rikul@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove auto save functionality for models Remove auto-save to allow manual editing before persistence Nov 26, 2025
Copilot AI requested a review from Rikul November 26, 2025 02:03
@Rikul
Rikul marked this pull request as ready for review November 26, 2025 03:49

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread views/UploadView.tsx
Comment on lines 46 to +49
lineItems: []
};
// We need the image even if analysis failed to initialize the record
if (image) initializeRecord(emptyData, image);
if (resizedImage) initializeRecord(emptyData, resizedImage);

@chatgpt-codex-connector chatgpt-codex-connector Bot Nov 26, 2025

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot
P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot

![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 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 👍 / 👎.

@Rikul
Rikul merged commit 986a805 into main Nov 26, 2025
2 checks passed
@Rikul
Rikul deleted the copilot/remove-auto-save-feature branch November 26, 2025 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants