Skip to content

fix: opening a different graph in a diagram that is already open - #52

Merged
endrix merged 1 commit into
mainfrom
fix/open-a-different-graph-in-an-open-diagram
Sep 4, 2026
Merged

fix: opening a different graph in a diagram that is already open#52
endrix merged 1 commit into
mainfrom
fix/open-a-different-graph-in-an-open-diagram

Conversation

@endrix

@endrix endrix commented Sep 4, 2026

Copy link
Copy Markdown
Owner

The problem

The open command stashes the requested graph name, then calls vscode.openWith:

if (requestedNetwork) {
    putPending(state.pendingNetworkBySourceUri, sourceUri.toString(), requestedNetwork);
}
await vscode.commands.executeCommand('vscode.openWith', sourceUri, profile.customEditorViewType);

The stash is read by the initial model request. An editor that already exists does not make one — openWith focuses it instead. So asking for a different graph inside a file you were already looking at did nothing at all: the name was recorded, the tab came forward, and the diagram kept showing what it showed before.

Moving between the graphs in one file is the ordinary use of this command, and it is the case where doing nothing is hardest to read, because the command plainly did something: the editor took focus. There is no way for a reader to tell a command that silently declined from one that was never wired up.

The change

When a diagram for the file is already open, refresh it with the requested name.

A refresh already carries networkName into a fresh model request — that is the mechanism a drill-down relies on — so this reuses it rather than adding a second path. Whether the diagram is already open is asked before opening, since opening is what makes it true.

The split-view command had the same shape and is fixed the same way. Leaving a known identical bug beside a fixed one is worse than fixing both.

Neither path changes for a diagram that is not yet open: the stash is still what the initial request reads, and no extra round trip is added to a fresh open.

Verified

npm run build, npm run typecheck (5/5), npm run check:neutrality (5/5), npm test — green by exit code.

The open command stashes the requested graph name and then calls
`vscode.openWith`. The stash is read by the INITIAL model request, and an editor
that already exists does not make one — `openWith` focuses it instead. So asking
for a different graph inside a file you were already looking at did nothing: the
name was recorded, the tab came forward, and the diagram kept showing what it
showed before.

That is the ordinary way to move between the graphs in one file, and it is the
case where nothing happening is hardest to read, because the command plainly did
SOMETHING — the editor took focus. A reader has no way to tell a command that
silently declined from one that is not wired up.

When a diagram for the file is already open, the command now refreshes it with
the requested name. A refresh already carries `networkName` into a fresh model
request; that is the mechanism a drill-down relies on, so this reuses it rather
than adding a second path. "Already open" is asked before opening, because
opening is what makes it true.

The split-view command had the same shape and is fixed the same way. Leaving a
known identical bug beside a fixed one is worse than fixing both.

Neither path changes for a diagram that is not yet open: the stash is still what
the initial request reads, and no extra round trip is added to a fresh open.
@endrix
endrix merged commit 011665c into main Sep 4, 2026
1 check passed
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