From 113d49abe9babba2b020066238c272155fbb25c1 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Thu, 5 Oct 2023 23:12:49 +0800 Subject: [PATCH] style: update detail --- src/client/api/socketio.ts | 2 +- src/client/api/trpc.ts | 2 +- src/client/components/WebsiteList.tsx | 9 ++++++++- src/server/udp/server.ts | 4 ++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/client/api/socketio.ts b/src/client/api/socketio.ts index ac7f81a..ef3662e 100644 --- a/src/client/api/socketio.ts +++ b/src/client/api/socketio.ts @@ -96,7 +96,7 @@ export function useSocketSubscribe( const [data, setData] = useState(defaultData); const cb = useEvent((_data) => { - setData(_data); + setData(_data ?? defaultData); }); useEffect(() => { diff --git a/src/client/api/trpc.ts b/src/client/api/trpc.ts index 6080fe7..1246469 100644 --- a/src/client/api/trpc.ts +++ b/src/client/api/trpc.ts @@ -1,5 +1,5 @@ import { createTRPCReact } from '@trpc/react-query'; -import type { AppRouter } from '../../server/trpc'; +import type { AppRouter } from '../../server/trpc/routers'; import { httpBatchLink, TRPCClientErrorLike } from '@trpc/client'; import { getJWT } from './auth'; import { message } from 'antd'; diff --git a/src/client/components/WebsiteList.tsx b/src/client/components/WebsiteList.tsx index 0ab62d0..7b832e9 100644 --- a/src/client/components/WebsiteList.tsx +++ b/src/client/components/WebsiteList.tsx @@ -131,7 +131,14 @@ const WebsiteListTable: React.FC<{ workspaceId: string }> = React.memo( return ; } - return ; + return ( +
+ ); } ); WebsiteListTable.displayName = 'WebsiteListTable'; diff --git a/src/server/udp/server.ts b/src/server/udp/server.ts index 4b0f5be..6169d85 100644 --- a/src/server/udp/server.ts +++ b/src/server/udp/server.ts @@ -11,6 +11,10 @@ const serverMap: Record< > = {}; createSubscribeInitializer('onServerStatusUpdate', (workspaceId) => { + if (!serverMap[workspaceId]) { + serverMap[workspaceId] = {}; + } + return serverMap[workspaceId]; });