Repository navigation
Fix tab switching not updating editor content due to model URI mismatch - #410
Merged
1000TurquoisePogs merged 3 commits intoOct 9, 2026
Merged
Conversation
1000TurquoisePogs
approved these changes
Aug 10, 2026
|
Martin-Zeithaml
approved these changes
Sep 25, 2026
Martin-Zeithaml
left a comment
Contributor
There was a problem hiding this comment.
In my opinion, the comment is a bit too long, though the change itself is straightforward.
Signed-off-by: Timothy Gerstel <tim.gerstel@gmail.com>
Signed-off-by: 1000TurquoisePogs <sgrady@rocketsoftware.com>
timgerstel
force-pushed
the
bugfix/tab-switch-model-uri-mismatch
branch
from
October 6, 2026 00:00
a376ba9 to
92aad36
Compare
|
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.



Proposed changes
This PR fixes a regression where switching between editor tabs did not update the displayed content -- the editor kept showing the previously active buffer even though a different tab was selected. It reproduces deterministically in a fresh session, for both USS files and MVS datasets/members.
Root cause: In
setMonacoModel(monaco.service.ts), models are created and looked up viamonaco.Uri.parse(model.uri)(a change introduced to give the reference/label provider a properUriwith a definedfsPath). However,fileDuplicateChecker()was left comparing the rawgenerateUri()string againstmodel.uri.toString(). Because Monaco registers models under their parsedUri.toString()(which can differ from the raw string), the duplicate check returnedfalsefor a buffer that was already open.setMonacoModelthen took the "not a duplicate" branch and callededitorCore.createModel(...)with a URI that already existed, which makes Monaco throw "Cannot add model because it already exists". That exception aborted the observable chain beforeeditor.setModel(newModel)ran, so the editor stayed attached to the previous model -- hence the stale content on tab switch.Fix:
fileDuplicateChecker()now normalizes the incoming URI the same way models are created/looked up (monaco.Uri.parse(uri).toString()) before comparing. The already-open buffer is correctly detected,getModel(...)returns the existing model, andsetModel(...)runs -- so the buffer switches as expected.This PR addresses Issue: [Link to Github issue within https://github.com/zowe/zlux/issues if any]
This PR depends upon the following PRs: N/A
Type of change
PR Checklist
Testing
cd zlux-editor/webClient && npm run build-- compiles cleanly with no new warnings.(MEMBER)), confirming content switches correctly.fsPath-related behavior that prompted themonaco.Uri.parsechange is unaffected).Further comments
The underlying issue is an inconsistency introduced when model creation/lookup switched from raw strings to parsed
monaco.Uriobjects without updating the duplicate check. Normalizing infileDuplicateCheckeris the minimal, low-risk fix and keeps a single source of truth for URI comparison. A slightly larger alternative would be to dropfileDuplicateCheckerentirely and rely oneditorCore.getModel(monaco.Uri.parse(model.uri))directly (returning the existing model if found, elsecreateModel), which removes the redundant model-list scan; I kept the smaller change to minimize blast radius, but I'm happy to refactor to that form if maintainers prefer. No automated test was added since the editor lacks a Monaco integration harness; if desired, a unit test aroundfileDuplicateCheckerasserting that a rawgenerateUri()string matches an existing parsed-Urimodel would lock in the fix.