From e09bd3e977905546601a5c48e4c3e411da3e1b84 Mon Sep 17 00:00:00 2001 From: twwu Date: Thu, 29 Jan 2026 10:39:40 +0800 Subject: [PATCH] refactor(Result): update setWorkflowProcessData to use useCallback and reset workflow process data on completion --- web/app/components/share/text-generation/result/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/app/components/share/text-generation/result/index.tsx b/web/app/components/share/text-generation/result/index.tsx index 32cc858771..05e6e30dcf 100644 --- a/web/app/components/share/text-generation/result/index.tsx +++ b/web/app/components/share/text-generation/result/index.tsx @@ -105,10 +105,10 @@ const Result: FC = ({ const getCompletionRes = () => completionResRef.current const [workflowProcessData, doSetWorkflowProcessData] = useState() const workflowProcessDataRef = useRef(undefined) - const setWorkflowProcessData = (data: WorkflowProcess) => { + const setWorkflowProcessData = useCallback((data: WorkflowProcess | undefined) => { workflowProcessDataRef.current = data doSetWorkflowProcessData(data) - } + }, []) const getWorkflowProcessData = () => workflowProcessDataRef.current const [currentTaskId, setCurrentTaskId] = useState(null) const [isStopping, setIsStopping] = useState(false) @@ -269,6 +269,7 @@ const Result: FC = ({ rating: null, }) setCompletionRes('') + setWorkflowProcessData(undefined) resetRunState() let res: string[] = []