diff --git a/browser_tests/assets/string_input.json b/browser_tests/assets/string_input.json new file mode 100644 index 0000000000..ee3e8aaddd --- /dev/null +++ b/browser_tests/assets/string_input.json @@ -0,0 +1,42 @@ +{ + "last_node_id": 1, + "last_link_id": 0, + "nodes": [ + { + "id": 1, + "type": "DevToolsNodeWithStringInput", + "pos": [ + 15, + 48 + ], + "size": [ + 315, + 58 + ], + "flags": {}, + "order": 0, + "mode": 0, + "inputs": [], + "outputs": [], + "properties": { + "Node name for S&R": "DevToolsNodeWithStringInput" + }, + "widgets_values": [ + "" + ] + } + ], + "links": [], + "groups": [], + "config": {}, + "extra": { + "ds": { + "scale": 1, + "offset": [ + 0, + 0 + ] + } + }, + "version": 0.4 +} \ No newline at end of file diff --git a/browser_tests/interaction.spec.ts b/browser_tests/interaction.spec.ts index c7fe22ed44..f4cd61bc1a 100644 --- a/browser_tests/interaction.spec.ts +++ b/browser_tests/interaction.spec.ts @@ -527,6 +527,13 @@ test.describe('Load workflow', () => { await comfyPage.loadWorkflow('string_node_id') await expect(comfyPage.canvas).toHaveScreenshot('string_node_id.png') }) + + test('Can load workflow with ("STRING",) input node', async ({ + comfyPage + }) => { + await comfyPage.loadWorkflow('string_input') + await expect(comfyPage.canvas).toHaveScreenshot('string_input.png') + }) }) test.describe('Load duplicate workflow', () => { diff --git a/browser_tests/interaction.spec.ts-snapshots/string-input-chromium-2x-linux.png b/browser_tests/interaction.spec.ts-snapshots/string-input-chromium-2x-linux.png new file mode 100644 index 0000000000..f35709c1fe Binary files /dev/null and b/browser_tests/interaction.spec.ts-snapshots/string-input-chromium-2x-linux.png differ diff --git a/browser_tests/interaction.spec.ts-snapshots/string-input-chromium-linux.png b/browser_tests/interaction.spec.ts-snapshots/string-input-chromium-linux.png new file mode 100644 index 0000000000..ed2e4a01f4 Binary files /dev/null and b/browser_tests/interaction.spec.ts-snapshots/string-input-chromium-linux.png differ diff --git a/src/scripts/app.ts b/src/scripts/app.ts index 6ec48b2b18..b36b9d8d8c 100644 --- a/src/scripts/app.ts +++ b/src/scripts/app.ts @@ -25,7 +25,7 @@ import { ComfyNodeDef, StatusWsMessageStatus } from '@/types/apiTypes' import { adjustColor, ColorAdjustOptions } from '@/utils/colorUtil' import { ComfyAppMenu } from './ui/menu/index' import { getStorageValue } from './utils' -import { ComfyWorkflow, useWorkflowStore } from '@/stores/workflowStore' +import { ComfyWorkflow } from '@/stores/workflowStore' import { LGraphCanvas, LGraph, @@ -1976,8 +1976,11 @@ export class ComfyApp { widget?: IBaseWidget } = { minWidth: 1, minHeight: 1 } for (const inputName in inputs) { - const inputData = inputs[inputName] - const type = inputData[0] + const _inputData = inputs[inputName] + const type = _inputData[0] + const options = _inputData[1] ?? {} + const inputData = [type, options] + const inputIsRequired = requiredInputs && inputName in requiredInputs let widgetCreated = true