[fix] Preserve per-workflow subgraph navigation state (#4616)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Christian Byrne
2025-07-31 19:37:17 -07:00
committed by GitHub
parent baea47c493
commit eae4b954d0
7 changed files with 230 additions and 76 deletions

View File

@@ -73,7 +73,8 @@ export class ChangeTracker {
offset: [app.canvas.ds.offset[0], app.canvas.ds.offset[1]]
}
const navigation = useSubgraphNavigationStore().exportState()
this.subgraphState = navigation.length ? { navigation } : undefined
// Always store the navigation state, even if empty (root level)
this.subgraphState = { navigation }
}
restore() {
@@ -90,8 +91,14 @@ export class ChangeTracker {
const activeId = navigation.at(-1)
if (activeId) {
// Navigate to the saved subgraph
const subgraph = app.graph.subgraphs.get(activeId)
if (subgraph) app.canvas.setGraph(subgraph)
if (subgraph) {
app.canvas.setGraph(subgraph)
}
} else {
// Empty navigation array means root level
app.canvas.setGraph(app.graph)
}
}
}