mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 11:11:53 +00:00
Fix DOM widgets disappear
This commit is contained in:
@@ -787,26 +787,29 @@ export class ComfyApp {
|
|||||||
LiteGraph.alt_drag_do_clone_nodes = true
|
LiteGraph.alt_drag_do_clone_nodes = true
|
||||||
LiteGraph.macGesturesRequireMac = false
|
LiteGraph.macGesturesRequireMac = false
|
||||||
|
|
||||||
this.canvas.canvas.addEventListener('litegraph:set-graph', (e) => {
|
this.canvas.canvas.addEventListener<'litegraph:set-graph'>(
|
||||||
type SetGraphType = CustomEvent<{
|
'litegraph:set-graph',
|
||||||
newGraph: LGraph | Subgraph
|
(e) => {
|
||||||
oldGraph: LGraph | Subgraph
|
// Assertion: Not yet defined in litegraph.
|
||||||
}>
|
const { newGraph } = e.detail
|
||||||
|
|
||||||
// Assertion: Not yet defined in litegraph.
|
const nodeSet = new Set(newGraph.nodes)
|
||||||
const { newGraph } = (e as SetGraphType).detail
|
const widgetStore = useDomWidgetStore()
|
||||||
|
|
||||||
const nodeSet = new Set(newGraph.nodes)
|
|
||||||
const widgetStore = useDomWidgetStore()
|
|
||||||
for (const { widget } of widgetStore.widgetStates.values()) {
|
|
||||||
// Assertions: UnwrapRef
|
// Assertions: UnwrapRef
|
||||||
if (nodeSet.has(widget.node as LGraphNode)) {
|
for (const { widget } of widgetStore.widgetStates.values()) {
|
||||||
widgetStore.registerWidget(widget as BaseDOMWidget)
|
if (!nodeSet.has(widget.node as LGraphNode)) {
|
||||||
} else {
|
widgetStore.unregisterWidget(widget.id)
|
||||||
widgetStore.unregisterWidget(widget.id)
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const { widget } of widgetStore.inactiveWidgetStates.values()) {
|
||||||
|
if (nodeSet.has(widget.node as LGraphNode)) {
|
||||||
|
widgetStore.registerWidget(widget as BaseDOMWidget)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
)
|
||||||
|
|
||||||
this.graph.start()
|
this.graph.start()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user