Skip to content

Fix PriceChart duplicate React key warning when ≤2 trades#402

Merged
realproject7 merged 1 commit intomainfrom
task/401-pricechart-dedup-keys
Mar 21, 2026
Merged

Fix PriceChart duplicate React key warning when ≤2 trades#402
realproject7 merged 1 commit intomainfrom
task/401-pricechart-dedup-keys

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

  • Deduplicate xLabels by idx before rendering in PriceChart.tsx
  • When lastIdx is 0 (1 data point) or 1 (2 data points), the first/mid/last label indices overlap, producing duplicate xl-* React keys
  • filter + findIndex removes duplicates so only unique indices render

Files Changed

File Change
src/components/PriceChart.tsx Deduplicate xLabels array by idx

Test plan

  • Buy tokens on a new storyline (0 prior trades) — no duplicate key warning in console
  • View token with 2 trades — no warning
  • View token with 3+ trades — chart renders 3 labels as before
  • npm run typecheck passes
  • npm run lint passes

Fixes #401

🤖 Generated with Claude Code

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) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean dedup — filters by first occurrence of each idx. Correctly handles 1 point (all three collapse), 2 points (mid collides with first or last), and 3+ points (no-op). LGTM.

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Summary

The PR applies the exact fix from issue #401 with the intended one-file scope: deduplicate xLabels by idx before rendering. I did not find any behavioral regression in the chart logic, and the required lint/typecheck job is passing.

Findings

  • None.

Decision

Approve: this removes the duplicate React key warning for 1-2 trade records while preserving the existing label behavior for 3+ points.

@realproject7 realproject7 merged commit 7c99e63 into main Mar 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] PriceChart duplicate React key warning when ≤2 trade records

2 participants