From fb08af96bd60e1939d2a3ee76b04b8c1f0157bee Mon Sep 17 00:00:00 2001 From: GyDi Date: Mon, 30 Oct 2023 00:53:24 +0800 Subject: [PATCH] fix: page null exception, close #821 --- src/components/connection/connection-item.tsx | 2 +- src/pages/connections.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/connection/connection-item.tsx b/src/components/connection/connection-item.tsx index d04bf21..d6c78eb 100644 --- a/src/components/connection/connection-item.tsx +++ b/src/components/connection/connection-item.tsx @@ -58,7 +58,7 @@ export const ConnectionItem = (props: Props) => { {!!metadata.process && {metadata.process}} - {chains.length > 0 && {chains[value.chains.length - 1]}} + {chains?.length > 0 && {chains[value.chains.length - 1]}} {dayjs(start).fromNow()} diff --git a/src/pages/connections.tsx b/src/pages/connections.tsx index 1b5f2e7..7c53f67 100644 --- a/src/pages/connections.tsx +++ b/src/pages/connections.tsx @@ -69,7 +69,7 @@ const ConnectionsPage = () => { 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) {