From 6a08e4ddde021fc099e271de3d682dc2df6badf5 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Wed, 25 Feb 2026 21:36:52 -0800 Subject: [PATCH] Revert "fix: sync DOM widget values to widgetValueStore on registration" (#9205) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reverts Comfy-Org/ComfyUI_frontend#9166 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9205-Revert-fix-sync-DOM-widget-values-to-widgetValueStore-on-registration-3126d73d365081df8944d3c6508d2372) by [Unito](https://www.unito.io) --- src/scripts/domWidget.ts | 14 --------- src/scripts/domWidgetStore.test.ts | 48 ------------------------------ 2 files changed, 62 deletions(-) delete mode 100644 src/scripts/domWidgetStore.test.ts diff --git a/src/scripts/domWidget.ts b/src/scripts/domWidget.ts index 11c9c5d730..38979bb81b 100644 --- a/src/scripts/domWidget.ts +++ b/src/scripts/domWidget.ts @@ -7,7 +7,6 @@ import { LegacyWidget, LiteGraph } from '@/lib/litegraph/src/litegraph' -import type { NodeId } from '@/lib/litegraph/src/litegraph' import type { IBaseWidget, IWidgetOptions @@ -15,7 +14,6 @@ import type { import type { InputSpec } from '@/schemas/nodeDef/nodeDefSchemaV2' import { useDomWidgetStore } from '@/stores/domWidgetStore' import { usePromotionStore } from '@/stores/promotionStore' -import { useWidgetValueStore } from '@/stores/widgetValueStore' import { generateUUID } from '@/utils/formatUtil' export interface BaseDOMWidget< @@ -152,18 +150,6 @@ abstract class BaseDOMWidgetImpl this.callback?.(this.value) } - override setNodeId(nodeId: NodeId): void { - // Capture the DOM-resolved value before registration, since the base class - // registers _state.value which is undefined for DOM widgets (their value - // lives in the DOM element / options.getValue). - const resolvedValue = this.value - super.setNodeId(nodeId) - const graphId = this.node.graph?.rootGraph.id - if (!graphId) return - const state = useWidgetValueStore().getWidget(graphId, nodeId, this.name) - if (state) state.value = resolvedValue - } - get margin(): number { return this.options.margin ?? BaseDOMWidgetImpl.DEFAULT_MARGIN } diff --git a/src/scripts/domWidgetStore.test.ts b/src/scripts/domWidgetStore.test.ts deleted file mode 100644 index 8cb75e4fb5..0000000000 --- a/src/scripts/domWidgetStore.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { createTestingPinia } from '@pinia/testing' -import { setActivePinia } from 'pinia' -import { beforeEach, describe, expect, it } from 'vitest' - -import { LGraph, LGraphNode } from '@/lib/litegraph/src/litegraph' -import { DOMWidgetImpl } from '@/scripts/domWidget' -import { useWidgetValueStore } from '@/stores/widgetValueStore' - -describe('DOMWidgetImpl store integration', () => { - let graph: LGraph - let node: LGraphNode - let store: ReturnType - - beforeEach(() => { - setActivePinia(createTestingPinia({ stubActions: false })) - store = useWidgetValueStore() - graph = new LGraph() - node = new LGraphNode('TestNode') - node.id = 1 - graph.add(node) - }) - - it('registers DOM-resolved value in store via setNodeId', () => { - const defaultValue = 'You are an expert image-generation engine.' - const element = document.createElement('textarea') - element.value = defaultValue - - const widget = new DOMWidgetImpl({ - node, - name: 'system_prompt', - type: 'customtext', - element, - options: { - getValue: () => element.value as string, - setValue: (v: string) => { - element.value = v - const state = store.getWidget(graph.id, node.id, 'system_prompt') - if (state) state.value = v - } - } - }) - - widget.setNodeId(node.id) - - const state = store.getWidget(graph.id, node.id, 'system_prompt') - expect(state?.value).toBe(defaultValue) - }) -})