mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-11 02:20:08 +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'
|
||||
@@ -74,8 +74,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 {
|
||||
getFlacMetadata,
|
||||
getLatentMetadata,
|
||||
@@ -735,11 +733,6 @@ export class ComfyApp {
|
||||
node.onAfterGraphConfigured?.()
|
||||
}
|
||||
|
||||
graph.canvasAction((c) => {
|
||||
const nodes = c.subgraph?.nodes ?? graph.nodes
|
||||
pruneWidgets(nodes)
|
||||
})
|
||||
|
||||
return r
|
||||
}
|
||||
}
|
||||
@@ -809,14 +802,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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1696,6 +1689,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