Skip to content
Snippets Groups Projects
Unverified Commit aba0826c authored by GyDi's avatar GyDi
Browse files

fix: connections is null

parent f032228d
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment