fix: normalize paths in monaco model cleanup#27
Merged
jmaxdev merged 2 commits intoTrixtyAI:mainfrom Apr 19, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes incorrect Monaco model disposal on Windows by normalizing file paths before comparing open files to Monaco model URIs, preventing active models from being disposed and the editor from rendering blank.
Changes:
- Normalize
openFilespaths and Monaco model paths before comparison, using aSetfor efficient membership checks. - Use
model.uri.scheme === "inmemory"to skip internal Monaco models. - Reduce effect re-runs by removing
currentFilefrom the cleanup effect dependency list and removing noisy disposal logging.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jmaxdev
approved these changes
Apr 19, 2026
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.
Changes
The model cleanup effect in
EditorArea.tsxwas comparingf.path(Windows backslashes) against Monaco URIs (forward slashes, URL-encoded). None of the three comparisons in.some()ever matched on Windows, so every newly created model was immediately disposed — leaving the editor rendering against a disposed model (empty content).Setlookup instead of the previous triple.some()fallback.model.uri.scheme === "inmemory"(cleaner thanstartsWith("inmemory://")).currentFilefrom the effect deps — onlyopenFilesmatters for lifecycle.openPathsvariable and theconsole.logon each dispose.Disposal still happens as originally intended — files that leave
openFileshave their models freed. The behavior is now correct on Windows and unchanged on Linux/macOS (where normalization is a no-op on paths that are already forward-slashed).Issues