mirror of https://github.com/langgenius/dify.git
fix loop variable not sync well
This commit is contained in:
parent
79fb977f10
commit
ebe7303894
|
|
@ -1,5 +1,6 @@
|
|||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useRef,
|
||||
} from 'react'
|
||||
import produce from 'immer'
|
||||
|
|
@ -26,6 +27,9 @@ const useConfig = (id: string, payload: LoopNodeType) => {
|
|||
|
||||
const { inputs, setInputs } = useNodeCrud<LoopNodeType>(id, payload)
|
||||
const inputsRef = useRef(inputs)
|
||||
useEffect(() => {
|
||||
inputsRef.current = inputs
|
||||
}, [inputs])
|
||||
const handleInputsChange = useCallback((newInputs: LoopNodeType) => {
|
||||
inputsRef.current = newInputs
|
||||
setInputs(newInputs)
|
||||
|
|
|
|||
Loading…
Reference in New Issue