From aba0826c380a4a8ba48e0e98f02b6043308f4f9e Mon Sep 17 00:00:00 2001 From: GyDi Date: Fri, 30 Jun 2023 09:02:17 +0800 Subject: [PATCH] fix: connections is null --- src/pages/connections.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/connections.tsx b/src/pages/connections.tsx index 535d3c0..9e2bce5 100644 --- a/src/pages/connections.tsx +++ b/src/pages/connections.tsx @@ -56,15 +56,16 @@ const ConnectionsPage = () => { const { connect, disconnect } = useWebsocket( (event) => { + // meta v1.15.0 出现data.connections为null的情况 const data = JSON.parse(event.data) as IConnections; // 尽量与前一次connections的展示顺序保持一致 setConnData((old) => { const oldConn = old.connections; - const maxLen = data.connections.length; + const maxLen = data.connections?.length; const connections: typeof oldConn = []; - const rest = data.connections.filter((each) => { + const rest = data.connections?.filter((each) => { const index = oldConn.findIndex((o) => o.id === each.id); if (index >= 0 && index < maxLen) {