From bac647480ff1a01b97644bc2af4c86e7026aab11 Mon Sep 17 00:00:00 2001 From: Santamaura Date: Tue, 22 Mar 2022 21:16:20 +0000 Subject: [PATCH] ui: handle latency not defined on network page Previously when a cluster with multiple nodes had a node stopped and then another node quickly started, the network page would crash. This was due to the node object holding the latency value being undefined and the ui trying to read this key when that was undefined. This occurs when a node is in an `UNAVAILABLE` state. This patch resolves the issue by being more defensive on the front end by safely attempting to access latency and if it is undefined, set the value to 0. The existing code is able to handle this case afterward and will eventually set the user friendly latency status to `--`. Resolves: #59322 Release note (ui change): Fixes a bug where a node in the `UNAVAILABLE` state will not have latency defined and cause the network page to crash. --- .../src/views/reports/containers/network/latency/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/ui/workspaces/db-console/src/views/reports/containers/network/latency/index.tsx b/pkg/ui/workspaces/db-console/src/views/reports/containers/network/latency/index.tsx index a3a4057a4dea..b2a0d17ede90 100644 --- a/pkg/ui/workspaces/db-console/src/views/reports/containers/network/latency/index.tsx +++ b/pkg/ui/workspaces/db-console/src/views/reports/containers/network/latency/index.tsx @@ -126,7 +126,7 @@ const renderMultipleHeaders = ( const row: any[] = []; displayIdentities.forEach(identityB => { const a = nodesSummary.nodeStatusByID[identityA.nodeID].activity; - const nano = FixLong(a[identityB.nodeID].latency); + const nano = FixLong(a[identityB.nodeID]?.latency || 0); if (identityA.nodeID === identityB.nodeID) { row.push({ latency: 0, identityB }); } else if (