mirror of https://github.com/langgenius/dify.git
Fix: avoid mutating node props (#26266)
Signed-off-by: Yongtao Huang <yongtaoh2022@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
0c1ec35244
commit
319ecdd312
|
|
@ -2,6 +2,7 @@ import type { FC } from 'react'
|
||||||
import {
|
import {
|
||||||
memo,
|
memo,
|
||||||
useEffect,
|
useEffect,
|
||||||
|
useState,
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import {
|
import {
|
||||||
Background,
|
Background,
|
||||||
|
|
@ -27,19 +28,20 @@ const Node: FC<NodeProps<IterationNodeType>> = ({
|
||||||
const nodesInitialized = useNodesInitialized()
|
const nodesInitialized = useNodesInitialized()
|
||||||
const { handleNodeIterationRerender } = useNodeIterationInteractions()
|
const { handleNodeIterationRerender } = useNodeIterationInteractions()
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
const [showTips, setShowTips] = useState(data._isShowTips)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (nodesInitialized)
|
if (nodesInitialized)
|
||||||
handleNodeIterationRerender(id)
|
handleNodeIterationRerender(id)
|
||||||
if (data.is_parallel && data._isShowTips) {
|
if (data.is_parallel && showTips) {
|
||||||
Toast.notify({
|
Toast.notify({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
message: t(`${i18nPrefix}.answerNodeWarningDesc`),
|
message: t(`${i18nPrefix}.answerNodeWarningDesc`),
|
||||||
duration: 5000,
|
duration: 5000,
|
||||||
})
|
})
|
||||||
data._isShowTips = false
|
setShowTips(false)
|
||||||
}
|
}
|
||||||
}, [nodesInitialized, id, handleNodeIterationRerender, data, t])
|
}, [nodesInitialized, id, handleNodeIterationRerender, data.is_parallel, showTips, t])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn(
|
<div className={cn(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue