From a430284aa21e3ae1f0d5654e55b2ad2852519cc2 Mon Sep 17 00:00:00 2001
From: wwf <yearningwang@iqtogether.com>
Date: 星期三, 04 六月 2025 15:17:49 +0800
Subject: [PATCH] 初始化

---
 app/components/workflow/nodes/_base/components/before-run-form/form.tsx |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/app/components/workflow/nodes/_base/components/before-run-form/form.tsx b/app/components/workflow/nodes/_base/components/before-run-form/form.tsx
index 884729c..967e796 100644
--- a/app/components/workflow/nodes/_base/components/before-run-form/form.tsx
+++ b/app/components/workflow/nodes/_base/components/before-run-form/form.tsx
@@ -1,6 +1,6 @@
 'use client'
 import type { FC } from 'react'
-import React, { useCallback, useEffect, useMemo, useRef } from 'react'
+import React, { useCallback, useMemo } from 'react'
 import produce from 'immer'
 import type { InputVar } from '../../../../types'
 import FormItem from './form-item'
@@ -46,20 +46,17 @@
 
     return m
   }, [inputs])
-  const valuesRef = useRef(values)
-  useEffect(() => {
-    valuesRef.current = values
-  }, [values])
+
   const handleChange = useCallback((key: string) => {
     const mKeys = mapKeysWithSameValueSelector.get(key) ?? [key]
     return (value: any) => {
-      const newValues = produce(valuesRef.current, (draft) => {
+      const newValues = produce(values, (draft) => {
         for (const k of mKeys)
           draft[k] = value
       })
       onChange(newValues)
     }
-  }, [valuesRef, onChange, mapKeysWithSameValueSelector])
+  }, [values, onChange, mapKeysWithSameValueSelector])
   const isArrayLikeType = [InputVarType.contexts, InputVarType.iterator].includes(inputs[0]?.type)
   const isContext = inputs[0]?.type === InputVarType.contexts
   const handleAddContext = useCallback(() => {
@@ -74,7 +71,7 @@
     <div className={cn(className, 'space-y-2')}>
       {label && (
         <div className='mb-1 flex items-center justify-between'>
-          <div className='system-xs-medium-uppercase flex h-6 items-center text-text-tertiary'>{label}</div>
+          <div className='flex items-center h-6 system-xs-medium-uppercase text-text-tertiary'>{label}</div>
           {isArrayLikeType && (
             <AddButton onClick={handleAddContext} />
           )}

--
Gitblit v1.8.0