From 7463bc9199e5f1cdb27b9952a4468d2eac9c0f48 Mon Sep 17 00:00:00 2001 From: twwu Date: Wed, 14 Jan 2026 16:36:37 +0800 Subject: [PATCH] feat: integrate workflow hook to handle output variable renaming in useFormContent --- .../workflow/nodes/human-input/hooks/use-form-content.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/app/components/workflow/nodes/human-input/hooks/use-form-content.ts b/web/app/components/workflow/nodes/human-input/hooks/use-form-content.ts index 16724d7873..c1a7591437 100644 --- a/web/app/components/workflow/nodes/human-input/hooks/use-form-content.ts +++ b/web/app/components/workflow/nodes/human-input/hooks/use-form-content.ts @@ -1,11 +1,13 @@ import type { FormInputItem, HumanInputNodeType } from '../types' import { produce } from 'immer' import { useCallback, useEffect, useRef, useState } from 'react' +import { useWorkflow } from '@/app/components/workflow/hooks' import useNodeCrud from '../../_base/hooks/use-node-crud' const useFormContent = (id: string, payload: HumanInputNodeType) => { const [editorKey, setEditorKey] = useState(0) const { inputs, setInputs } = useNodeCrud(id, payload) + const { handleOutVarRenameChange } = useWorkflow() const inputsRef = useRef(inputs) useEffect(() => { inputsRef.current = inputs @@ -35,7 +37,11 @@ const useFormContent = (id: string, payload: HumanInputNodeType) => { }) setInputs(newInputs) setEditorKey(editorKey => editorKey + 1) - }, [setInputs]) + + // Update downstream nodes that reference this variable + if (oldName !== payload.output_variable_name) + handleOutVarRenameChange(id, [id, oldName], [id, payload.output_variable_name]) + }, [setInputs, handleOutVarRenameChange, id]) const handleFormInputItemRemove = useCallback((varName: string) => { const inputs = inputsRef.current