From b7edd9a79f9c56f6e0a6a76545bdbeb4f73a147f Mon Sep 17 00:00:00 2001 From: Cho Young-Hwi Date: Sat, 21 Mar 2026 07:29:45 +0000 Subject: [PATCH] =?UTF-8?q?[#401]=20Fix=20PriceChart=20duplicate=20React?= =?UTF-8?q?=20key=20warning=20when=20=E2=89=A42=20trades?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Deduplicate xLabels by idx before rendering so that overlapping indices (lastIdx=0 or 1) no longer produce duplicate xl-* keys. Fixes #401 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/components/PriceChart.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/PriceChart.tsx b/src/components/PriceChart.tsx index 67a407bc..a77f2b30 100644 --- a/src/components/PriceChart.tsx +++ b/src/components/PriceChart.tsx @@ -120,12 +120,15 @@ export function PriceChart({ tokenAddress, currentPriceRaw }: PriceChartProps) { // Y-axis ticks const yTicks = [minY, (minY + maxY) / 2, maxY]; - // X-axis time labels (first, mid, last) - const xLabels = [ + // X-axis time labels (first, mid, last) — deduplicated when indices overlap + const xLabelCandidates = [ { idx: 0, label: formatTime(points[0].time) }, { idx: Math.floor(lastIdx / 2), label: formatTime(points[Math.floor(lastIdx / 2)].time) }, { idx: lastIdx, label: formatTime(points[lastIdx].time) }, ]; + const xLabels = xLabelCandidates.filter( + (item, i, arr) => arr.findIndex((a) => a.idx === item.idx) === i, + ); return (