Skip to content

Prevent auto-save reload from clobbering unsaved recap edits#257

Open
onurmatik wants to merge 7 commits into
mainfrom
codex/address-issue-in-history.js-at-line-343
Open

Prevent auto-save reload from clobbering unsaved recap edits#257
onurmatik wants to merge 7 commits into
mainfrom
codex/address-issue-in-history.js-at-line-343

Conversation

@onurmatik
Copy link
Copy Markdown
Owner

Summary

  • preserve user edits typed during an in-flight recap auto-save by restoring them after the history reload
  • keep the baseline and save indicator dirty when unsaved changes remain post-save so queued auto-saves still fire

Testing

  • not run (front-end change)

https://chatgpt.com/codex/tasks/task_b_68fbb102f3d88328b44e753d5fadc961

Copy link
Copy Markdown

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

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 on lines 633 to 637
baseline = normalizedText;
const preReloadValue = textarea ? getValue() : null;
const preReloadNormalized = textarea ? norm(preReloadValue) : '';
const hadUnsavedDuringSave = textarea ? preReloadNormalized !== normalizedText : false;
await afterPersistedChange();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Snapshot unsaved text too early during auto-save reload

preReloadValue is captured before await afterPersistedChange(). While that reload request is in flight the editor remains editable, so a user can keep typing after this snapshot. When the reload later overwrites the textarea and the code restores preReloadValue, any keystrokes typed after the snapshot but before the reload finishes are discarded. Capture the value inside the reload callback or merge the current value after the reload to avoid dropping recent edits on slow saves.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant