mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-07 08:30:06 +00:00
Clear DOM widgets instead of trying to manage refs
This commit is contained in:
@@ -5,7 +5,7 @@ import {
|
||||
LGraphNode,
|
||||
LiteGraph
|
||||
} from '@comfyorg/litegraph'
|
||||
import type { Subgraph, Vector2 } from '@comfyorg/litegraph'
|
||||
import type { Vector2 } from '@comfyorg/litegraph'
|
||||
import type { IBaseWidget } from '@comfyorg/litegraph/dist/types/widgets'
|
||||
import _ from 'lodash'
|
||||
import type { ToastMessageOptions } from 'primevue/toast'
|
||||
@@ -69,8 +69,6 @@ import { deserialiseAndCreate } from '@/utils/vintageClipboard'
|
||||
|
||||
import { type ComfyApi, PromptExecutionError, api } from './api'
|
||||
import { defaultGraph } from './defaultGraph'
|
||||
import type { BaseDOMWidget } from './domWidget'
|
||||
import { pruneWidgets } from './domWidget'
|
||||
import { importA1111 } from './pnginfo'
|
||||
import { $el, ComfyUI } from './ui'
|
||||
import { ComfyAppMenu } from './ui/menu/index'
|
||||
@@ -724,11 +722,6 @@ export class ComfyApp {
|
||||
node.onAfterGraphConfigured?.()
|
||||
}
|
||||
|
||||
graph.canvasAction((c) => {
|
||||
const nodes = c.subgraph?.nodes ?? graph.nodes
|
||||
pruneWidgets(nodes)
|
||||
})
|
||||
|
||||
return r
|
||||
}
|
||||
}
|
||||
@@ -798,14 +791,14 @@ export class ComfyApp {
|
||||
|
||||
// Assertions: UnwrapRef
|
||||
for (const { widget } of widgetStore.widgetStates.values()) {
|
||||
if (!nodeSet.has(widget.node as LGraphNode)) {
|
||||
widgetStore.unregisterWidget(widget.id)
|
||||
if (!nodeSet.has(widget.node)) {
|
||||
widgetStore.deactivateWidget(widget.id)
|
||||
}
|
||||
}
|
||||
|
||||
for (const { widget } of widgetStore.inactiveWidgetStates.values()) {
|
||||
if (nodeSet.has(widget.node as LGraphNode)) {
|
||||
widgetStore.registerWidget(widget as BaseDOMWidget)
|
||||
for (const { widget } of widgetStore.inactiveWidgetStates) {
|
||||
if (nodeSet.has(widget.node)) {
|
||||
widgetStore.activateWidget(widget.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1569,6 +1562,8 @@ export class ComfyApp {
|
||||
const executionStore = useExecutionStore()
|
||||
executionStore.lastNodeErrors = null
|
||||
executionStore.lastExecutionError = null
|
||||
|
||||
useDomWidgetStore().clear()
|
||||
}
|
||||
|
||||
clientPosToCanvasPos(pos: Vector2): Vector2 {
|
||||
|
||||
Reference in New Issue
Block a user