Skip to content

Commit d6c8b44

Browse files
committed
fix: missing react key in chart all component list
1 parent bd3b3ea commit d6c8b44

File tree

1 file changed

+10
-6
lines changed
  • plugins/plugin-codeflare/src/controller/charts

1 file changed

+10
-6
lines changed

plugins/plugin-codeflare/src/controller/charts/all.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import { toHostMap } from "./LogRecord"
2222
import { timeRange } from "./timestamps"
2323

2424
/** Oops, sometimes we have no data for a give node */
25-
function noData(node: string, kind: "CPU Utilization" | "GPU Utilization") {
25+
function noData(node: string, kind: "CPU Utilization" | "GPU Utilization", idx: number) {
2626
return (
27-
<div className="flex-layout" title={`No ${kind} for ${node}`}>
27+
<div key={`nodata-${kind}-${idx}`} className="flex-layout" title={`No ${kind} for ${node}`}>
2828
<span className="flex-fill flex-layout flex-align-center">no data</span>
2929
</div>
3030
)
@@ -76,15 +76,19 @@ export default async function all(args: Arguments) {
7676
const range = timeRange(gpuData, cpuData)
7777

7878
const linearized = nodes
79-
.map((node) => {
79+
.map((node, idx) => {
8080
const gpuForNode = gpuMap[node]
8181
const cpuForNode = cpuMap[node]
8282
return [
83-
!gpuForNode ? noData(node, "GPU Utilization") : <GPUChart timeRange={range} logs={{ [node]: gpuForNode }} />,
83+
!gpuForNode ? (
84+
noData(node, "GPU Utilization", idx)
85+
) : (
86+
<GPUChart key={`gpu-${node}`} timeRange={range} logs={{ [node]: gpuForNode }} />
87+
),
8488
!cpuForNode ? (
85-
noData(node, "CPU Utilization")
89+
noData(node, "CPU Utilization", idx)
8690
) : (
87-
<VmstatChart timeRange={range} logs={{ [node]: cpuMap[node] }} />
91+
<VmstatChart key={`cpu-${node}`} timeRange={range} logs={{ [node]: cpuMap[node] }} />
8892
),
8993
]
9094
})

0 commit comments

Comments
 (0)