Skip to content

Skip combined diff section publication echo reads - #35017

Closed
OrcaWin wants to merge 1 commit into
mainfrom
OrcaWin/editor-combined-diff-content-echo
Closed

OrcaWin wants to merge 1 commit into
mainfrom
OrcaWin/editor-combined-diff-content-echo

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​333 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​333
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​49 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​47

ELI5

Editing an editable section in the combined Changes view no longer rereads the whole draft just to confirm text that the editor already published.

What Changed

Capture the actual model, version and content when publishing a section draft. Keep the controlled wrapper prop stable only for that exact publication echo. Reuse the existing content-sync helper for an external reset that equals the held wrapper prop, and retire publication metadata with the editor.

This covers DiffSectionItem → DiffSectionBody; #34961 covers the separate DiffViewer path.

Why

In a rendered 115,000-character combined-diff section, typing, Undo and Redo each performed two full editor reads. The same actions now perform one required publication read, while section text and dirty state still match the live model.

Linked Issue

Internal editor performance audit; no existing issue.

Visual Proof

N/A — no presentation or interaction change is intended. Before/after hidden Electron screenshots were inspected; the measured change is the avoided full-text equality read.

Testing

  • Manually exercised the combined Changes view in background Linux development Electron on an isolated display.
  • Added six real-model tests through the installed React wrapper, plus three existing body-lifecycle tests: nine pass. The two document-size cost regressions fail on the base.
  • Checked external resets to held/new text, Undo/Redo, generation and actual-model replacement, sibling/read-only sections, collapse/reopen and teardown. Rendered controls preserve exact draft and dirty state; collapse disposes the retired model.
  • Required pnpm check:changed --maxWorkers=2: all 21 checks pass (117.2s).

Review

Self-reviewed model/version/path ownership and cleanup. Existing platform, folder-workspace and remote routing are retained; native macOS/Windows, physical mobile and live SSH were not executed. Counts establish avoided work; CPU, latency and heap impact were not measured. One previous wrapper-prop string reference per mounted section remains until an external update, path change or teardown.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer content copied.

@OrcaWin

OrcaWin commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator Author

Closing after an adversarial review pass (correctness + value lenses, judged per cluster).

Closing. This is the same stale-controlled-prop pattern as #34961, applied to combined-diff sections. It adds three refs, render-time Monaco version and isDisposed checks, and a manual layout-effect syncContentUpdate path, all to save one getValue() per keystroke on a path dominated by the existing publish read, the sections map and re-render, and diff-worker recompute. Nothing was measured. It also keeps a stale full-content string alive per mounted section and touches the same publish line as #35036. The 333-line test counts mock reads. It fails both arms of #27143.

@OrcaWin OrcaWin closed this Oct 28, 2026
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.

1 participant