Repository navigation
Stale delayed edits in notebook and rich Markdown views no longer overwrite newer text - #31760
Merged
Merged
Conversation
… overwriting A rich Markdown or notebook view commits its typing into the tab's shared text after a short delay. If another pane of the same tab (or a disk reload) replaced that text in the meantime, the delayed commit either overwrote the newer text (notebook) or was silently dropped (rich Markdown). Each pending commit now carries the text it was based on; a commit onto newer text is refused, the view re-syncs, and a toast says the last edit in that view couldn't be applied. Notebooks also commit pending drafts when focus leaves them, so ordinary alternation between panes never goes stale. CSV already refuses stale cell edits. Co-Authored-By: Claude <noreply@anthropic.com>
… rejecting stale view edits - Notebook drafts record each cell's source when typing began; a flush merges drafts whose cell is unchanged onto the latest notebook and drops only drafts whose cell changed or no longer resolves (position keys also require the same cell layout). The toast fires only when typing was actually lost. - An acknowledgement that empties the draft map clears the flush timer and bases. - Rich markdown flushes its pending edit when focus leaves the view; the debounce/flush logic moves into useRichMarkdownPendingSerialization. - Dropped or cancelled edits republish the shared text so the tab's dirty flag is recomputed. - Discard bumps its epoch before flushing, so pending edits it cancels never toast. - Clearer toast copy in every locale. Co-Authored-By: Claude <noreply@anthropic.com>
…aving rejected edits - A notebook flush republishes only after its own typing, a dropped draft, or a real change, so stale text never lands over another view's newer text. - The rich flush reports whether it rejected the pending edit; Cmd/Ctrl+S skips the save when it did. - The rich discard epoch is captured where the serialize timer starts, replacing the dirty-hint wrapper; the redundant shared-text comparison is removed. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
3 of 5 tasks
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.
ELI5
Rich Markdown and notebook views wait a moment before writing your typing into the file. If the file changed somewhere else in that moment (another view of the same file, another workspace, the phone), the delayed write could overwrite the newer text — or, in Markdown, your typing silently vanished. Now a stale delayed write is refused and a short toast says so, and edits to notebook cells nobody else touched are kept.
What Changed
Why
The rejection is checked against the text each edit was based on, so a stale edit can never overwrite newer text. Merging per cell keeps the common case (two people/views editing different cells) working as before.
Linked Issue
N/A (maintainer).
Visual Proof
A notebook open in two split panes; the left pane's delayed edit arrived after the file had changed elsewhere:
Testing
Regression tests: split-pane notebook overwrite (fails on main), different cells edited in two panes both kept, same-cell conflict rejected with toast, no toast after acknowledgement or Discard, rich pending edit cancelled with toast, focus-leave flush, Cmd/Ctrl+S skipping a rejected edit, notebook not republishing older text.
Editor tests (2,911),
pnpm tc,check:code-quality:changed, oxfmt, oxlint, localization checks pass.Screenshot captured from a background, isolated Orca build; the other view's change was driven through the app because clicking into the other pane writes the first pane's typing immediately.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
CSV views are unchanged (they already refuse stale cell edits inline). No wire or persisted-state change.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)