From bea38a7e3624b3e48e9555e8896da0d6db1cdf27 Mon Sep 17 00:00:00 2001 From: zly Date: Tue, 2 Jun 2026 13:59:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=8A=B6=E6=80=81=E4=B8=8E=E7=94=BB=E5=B8=83?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E7=8A=B6=E6=80=81=E7=9A=84=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useFlowCallbacks.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/hooks/useFlowCallbacks.ts b/src/hooks/useFlowCallbacks.ts index 91b53c1..c137637 100644 --- a/src/hooks/useFlowCallbacks.ts +++ b/src/hooks/useFlowCallbacks.ts @@ -129,6 +129,10 @@ export const useFlowCallbacks = ( return getCurrentAppKey(currentAppData) || initialData?.appId; }, [initialData]); + const refreshAppList = useCallback(() => { + document.dispatchEvent(new CustomEvent('refreshAppList')); + }, []); + // region 画布操作 // 节点变更处理,添加防抖机制 const onNodesChange = useCallback( @@ -1406,6 +1410,7 @@ export const useFlowCallbacks = ( // 更新运行ID dispatch(updateRuntimeId(res.data)); + refreshAppList(); // 开始运行时动画 setEdges((eds) => @@ -1439,6 +1444,7 @@ export const useFlowCallbacks = ( // 更新运行ID dispatch(updateRuntimeId(res.data)); + refreshAppList(); // 开始运行时动画 setEdges((eds) => @@ -1467,9 +1473,8 @@ export const useFlowCallbacks = ( } else { // 特殊停止逻辑,持久化运行的应用使用这里的入参 await stopApp(currentAppData.instanceId); - // 特殊停止完成后触发事件,通知刷新应用列表 - document.dispatchEvent(new CustomEvent('refreshAppList')); } + refreshAppList(); // 重置节点状态 dispatch(resetNodeStatus()); @@ -1495,7 +1500,7 @@ export const useFlowCallbacks = ( } } }, - [getCurrentFlowAppKey] + [getCurrentFlowAppKey, refreshAppList] ); // 暂停/恢复应用