fix: reset diff caches on graph instance change

Clears nodeStatesCache, currentNodeIds, lastNodeCount, lastLinkCount,
and lastGraphVersion when getDataSource detects a new LGraph instance
(e.g. subgraph navigation). Prevents stale baselines from masking
connection/structure changes on the new graph.

Addresses: https://github.com/Comfy-Org/ComfyUI_frontend/pull/9912#discussion_r2934626767
This commit is contained in:
bymyself
2026-03-15 23:08:48 -07:00
parent a88e0d3856
commit cf5e8b433c

View File

@@ -126,6 +126,11 @@ export function useMinimapGraph(
if (cachedDataSource && cachedDataSourceGraph === g) {
return cachedDataSource
}
nodeStatesCache.clear()
currentNodeIds.clear()
lastNodeCount.value = 0
lastLinkCount = 0
lastGraphVersion = -1
cachedDataSource = MinimapDataSourceFactory.create(g)
cachedDataSourceGraph = g
return cachedDataSource