Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(site): dispose Monaco diff models on unmount (#28503) - #28806

Merged
mtojek merged 2 commits into
release/2.34from
jakehwll/DEVEX-736-backport-2.34
Sep 1, 2026
Merged

fix(site): dispose Monaco diff models on unmount (#28503)#28806
mtojek merged 2 commits into
release/2.34from
jakehwll/DEVEX-736-backport-2.34

Conversation

@jakehwll

@jakehwll jakehwll commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🤖 This PR was written by Coder Agents on behalf of Jake Howell.

Backport of #28503 to release/2.34.

Refs DEVEX-736. This carries the Monaco diff-model lifecycle cleanup and Storybook regression coverage into 2.34, preventing template-version navigation from retaining models until the editor becomes unusable.

The cherry-pick conflict was limited to theme imports. This keeps the release branch's existing @emotion/react integration while applying the original functional fix.

Backport of #28503 to release/2.34.

Opening template versions leaked Monaco text models: each changed file
rendered a `DiffEditor` with `keepCurrentOriginalModel` /
`keepCurrentModifiedModel`, so `@monaco-editor/react` never disposed the
underlying models and navigating between versions accumulated them until
the tab ran out of memory.

Move the diff editor into a `DiffFile` component that captures the
original/modified models in `onMount` and disposes them when it unmounts,
including when a file switches diff to plain while `SyntaxHighlighter`
stays mounted. Disposal is deferred with `queueMicrotask` so it runs after
the diff widget teardown, which otherwise throws "TextModel got disposed
before DiffEditorWidget model got reset".

Adds `SyntaxHighlighter.stories.tsx` with a `DisposesModelsOnDiffToggle`
play test that asserts the live model count returns to its baseline across
diff/plain toggles.

(cherry picked from commit 5008603)
@jakehwll jakehwll added the backport/v2.34 Backport PR targeting release/2.34 label Sep 1, 2026
@jakehwll jakehwll self-assigned this Sep 1, 2026
@linear-code

linear-code Bot commented Sep 1, 2026

Copy link
Copy Markdown

DEVEX-736

@jakehwll
jakehwll marked this pull request as ready for review September 1, 2026 07:30
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-01T07:34:58.601759Z 06da0f9 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@mtojek
mtojek self-requested a review September 1, 2026 07:49
@mtojek
mtojek self-requested a review September 1, 2026 07:50
@mtojek
mtojek merged commit c539ca5 into release/2.34 Sep 1, 2026
60 of 65 checks passed
@mtojek
mtojek deleted the jakehwll/DEVEX-736-backport-2.34 branch September 1, 2026 08:08
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport/v2.34 Backport PR targeting release/2.34

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants