From f2f3c65cf3933bedc9e67a8a9f3020e640f46c35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=BD=B3=E9=91=AB?= <695997094@qq.com> Date: Fri, 14 Aug 2026 09:41:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E5=82=AC=E5=8A=9E=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/task/instance/history/index.tsx | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/executor/tools/task/instance/history/index.tsx b/src/executor/tools/task/instance/history/index.tsx index bbc19635c..0af3fb280 100644 --- a/src/executor/tools/task/instance/history/index.tsx +++ b/src/executor/tools/task/instance/history/index.tsx @@ -38,6 +38,22 @@ interface AllTask extends schema.XWorkTask { task: IWorkTask; } +const globalState = { + isSendInfo: false, + listeners: new Set<(value: boolean) => void>(), + + set(value: any) { + this.isSendInfo = value; + this.listeners.forEach((listener) => listener(value)); + }, + + subscribe(listener: any) { + this.listeners.add(listener); + listener(this.isSendInfo); + return () => this.listeners.delete(listener); + }, +}; + export const ApprovalHistory: React.FC<{ current: IWorkTask; instance: schema.XWorkInstance; @@ -69,14 +85,22 @@ export const ApprovalHistory: React.FC<{ return _tasks; }, [current]); - let isSendInfo = false; + const [isSendInfo, setIsSendInfo] = useState(false); useEffect(() => { - const id = controller?.subscribe((type, flag_, _: any, tag: string) => { + setIsSendInfo(globalState.isSendInfo); + + const unsubscribe = globalState.subscribe((value: any) => { + setIsSendInfo(value); + }); + const commandId = controller?.subscribe((type, flag_, _: any, tag: string) => { + console.log('type====>', type, flag_, tag); if (type != 'preview' || flag_ != 'work') return; - isSendInfo = tag === '已发起'; + const newValue = tag === '已发起'; + globalState.set(newValue); }); return () => { - controller?.unsubscribe(id); + unsubscribe(); + command.unsubscribe(commandId); }; }, []); -- Gitee From 409ce3bd50577abdd0490081887556656fb5c842 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E4=BD=B3=E9=91=AB?= <695997094@qq.com> Date: Fri, 14 Aug 2026 09:42:28 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/executor/tools/task/instance/history/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/executor/tools/task/instance/history/index.tsx b/src/executor/tools/task/instance/history/index.tsx index 0af3fb280..4ea52c4e9 100644 --- a/src/executor/tools/task/instance/history/index.tsx +++ b/src/executor/tools/task/instance/history/index.tsx @@ -93,7 +93,6 @@ export const ApprovalHistory: React.FC<{ setIsSendInfo(value); }); const commandId = controller?.subscribe((type, flag_, _: any, tag: string) => { - console.log('type====>', type, flag_, tag); if (type != 'preview' || flag_ != 'work') return; const newValue = tag === '已发起'; globalState.set(newValue); -- Gitee