Line data Source code
1 : import type { LGraphNode } from '@comfyorg/graph-model/entityRegistry'
2 :
3 : import { createNodeLocatorId } from '@comfyorg/graph-model/nodeIdentification'
4 : import { parseNodeId } from '@comfyorg/graph-model/nodeId'
5 :
6 : import { usePreviewExposureStore } from './previewExposureStore'
7 : import { useWidgetValueStore } from './widgetValueStore'
8 :
9 10998 : export function clearNodeOwnedStoreState(node: LGraphNode): void {
10 10998 : const graph = node.graph
11 10998 : if (!graph) return
12 :
13 10998 : const rootGraphId = graph.isRootGraph ? graph.id : graph.rootGraph.id
14 10998 : const nodeId = parseNodeId(node.id) ?? node.id
15 10998 : useWidgetValueStore().clearNode(rootGraphId, nodeId)
16 10998 : usePreviewExposureStore().clearHost(
17 : rootGraphId,
18 : createNodeLocatorId(
19 : graph.isRootGraph || graph.id === rootGraphId ? null : graph.id,
20 : nodeId
21 : )
22 : )
23 : }
|