From 77950e48c76f4a3b29d01831d43039caba29888a Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期二, 18 十一月 2025 14:12:42 +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