Skip to content

fix(editor): apply external updates to the code editor as the span that changed - #10259

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/editor-incremental-external-updates
Nov 20, 2026
Merged

waleedlatif1 merged 1 commit into
stagingfrom
fix/editor-incremental-external-updates

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #10250. External updates to the code editor (an agent streaming into a file, a Code tab refresh, a reload) reached Pierre as a whole new document each time. The file viewer reveals a stream once per frame, so the cost of every frame grew with the file:

Streaming into a file Before After
2,600 lines 61 fps, no stalls 61 fps, no stalls
19,500 lines 50 fps, 1 stall (52 ms) 60 fps, no stalls
39,000 lines 28 fps, 42 stalls (up to 79 ms) 61 fps, no stalls

The editor now applies only the span that differs, through Pierre's incremental applyEdits. An append takes a single native comparison. Unchanged lines keep their scroll position, selection and tokens, and the update is still cleared from undo history. Before the editor attaches, the document item itself still carries the value.

Type of Change

  • Bug fix

Testing

Browser harness running the real CodeEditor and TextEditor:

  • Streaming benchmark above.
  • In-place rewrite of two spans, full replacement, an external append while the user edits, undo never reverting an external update, and a CRLF stream staying in sync with no update loop.
  • The existing 27-check interaction suite, the keyboard shortcuts, and the context-menu clipboard actions.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…at changed

A streamed write, a Code tab refresh or a reload reached Pierre as a whole new document
on every update. The agent's paced reveal updates every frame, so a 40,000-line file
streamed at 28 fps with 42 main-thread stalls. The editor now applies only the span
that differs (a single native comparison for an append), through Pierre's incremental
edits: every size up to 40,000 lines streams at 60 fps with no stalls. Unchanged lines
keep their scroll position, selection and tokens, and the update stays out of undo.
@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 20, 2026 10:18pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

CodeEditor now applies external updates through applyEdits instead of replacing the whole document.

  • Code editors apply external updates only where the text changed.

No actionable issues were established. Runtime checks were not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[External value changes] --> B{Editor attached?}
  B -->|No| C[Update published document]
  B -->|Yes| D[Find changed span]
  D --> E[Apply edit through Pierre]
  E --> F[Receive matching change event]
  F --> G[Clear undo history and update editorText]
Loading

Reviews (1) · Last reviewed commit: "fix(editor): apply external updates to t..." · Reviewed by Greptile

@waleedlatif1
waleedlatif1 merged commit 9f5d117 into staging Nov 20, 2026
83 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/editor-incremental-external-updates branch November 20, 2026 22:25

This branch was previously deployed

1 inactive deployment
Preview — 64567b5b Deployed Nov 20, 2026 by vercel[bot]
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