From 6e0aa7766c37470d36691392cdd921cff62b5469 Mon Sep 17 00:00:00 2001 From: hjlarry Date: Fri, 10 Oct 2025 10:18:23 +0800 Subject: [PATCH] sync the create/delete app in the list page --- web/app/components/apps/list.tsx | 9 ++++----- .../workflow/collaboration/core/websocket-manager.ts | 7 ------- web/app/components/workflow/collaboration/index.ts | 2 +- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/web/app/components/apps/list.tsx b/web/app/components/apps/list.tsx index 5f111c89c2..30083f16cb 100644 --- a/web/app/components/apps/list.tsx +++ b/web/app/components/apps/list.tsx @@ -134,15 +134,14 @@ const List = () => { ) useEffect(() => { - if (!workflowIds.length) - return - const timer = window.setInterval(() => { - refreshOnlineUsers() + mutate() + if (workflowIds.length) + refreshOnlineUsers() }, 10000) return () => window.clearInterval(timer) - }, [workflowIds.join(','), refreshOnlineUsers]) + }, [workflowIds.join(','), mutate, refreshOnlineUsers]) const anchorRef = useRef(null) const options = [ diff --git a/web/app/components/workflow/collaboration/core/websocket-manager.ts b/web/app/components/workflow/collaboration/core/websocket-manager.ts index cbcc04fb1b..ba4a45eee7 100644 --- a/web/app/components/workflow/collaboration/core/websocket-manager.ts +++ b/web/app/components/workflow/collaboration/core/websocket-manager.ts @@ -116,10 +116,3 @@ export class WebSocketClient { } export const webSocketClient = new WebSocketClient() - -export const fetchAppsOnlineUsers = async (appIds: string[]) => { - const response = await fetch(`/api/online-users?${new URLSearchParams({ - app_ids: appIds.join(','), - })}`) - return response.json() -} diff --git a/web/app/components/workflow/collaboration/index.ts b/web/app/components/workflow/collaboration/index.ts index 51cbb1a489..89cbb3aa43 100644 --- a/web/app/components/workflow/collaboration/index.ts +++ b/web/app/components/workflow/collaboration/index.ts @@ -1,5 +1,5 @@ export { collaborationManager } from './core/collaboration-manager' -export { webSocketClient, fetchAppsOnlineUsers } from './core/websocket-manager' +export { webSocketClient } from './core/websocket-manager' export { CursorService } from './services/cursor-service' export { useCollaboration } from './hooks/use-collaboration' export * from './types'