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

Skip to content

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

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

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

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.36.

Refs DEVEX-736. This carries the Monaco diff-model lifecycle cleanup and Storybook regression coverage into 2.36, 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.

…els on unmount (#28503)

Opening template versions leaked Monaco text models: SyntaxHighlighter sets
keepCurrent{Original,Modified}Model so @monaco-editor/react does not dispose
the models, and no stable model paths are supplied, so every visit created
anonymous models that were never freed.

Move the diff editor into a DiffFile component that captures the original and
modified models in onMount and disposes them in its own unmount effect, so the
cleanup also runs when a file switches diff to plain while SyntaxHighlighter
stays mounted. Disposal is deferred with queueMicrotask because freeing the
models in the same synchronous teardown throws "TextModel got disposed before
DiffEditorWidget model got reset".

Adds a Storybook story that toggles diff to plain repeatedly and asserts the
model count returns to its baseline.

(cherry picked from commit 5008603)
@jakehwll jakehwll added the backport/v2.36 Backport PR targeting release/2.36 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:33:01.399311Z 64df629 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:40
@mtojek
mtojek merged commit 0d7cd26 into release/2.36 Sep 1, 2026
26 checks passed
@mtojek
mtojek deleted the jakehwll/DEVEX-736-backport-2.36 branch September 1, 2026 08:01
@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.36 Backport PR targeting release/2.36

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants