fix(platform): format org timeline tooltip values as percentages - #161
Merged
Conversation
The tooltip formatter matched on the series' `name` argument against
dataKey strings ("commits", "stabilization", "aiPctNorm"), but each
Line/Bar sets an explicit `name` prop (the translated label, e.g.
"Estabilização") — Recharts passes that prop value as `name`, not the
dataKey, so the match always missed and fell through to the raw,
unrounded 0..1 decimal (e.g. "0.5860367647058823" instead of "59%").
Match on the payload entry's `dataKey` instead, which Recharts always
populates regardless of the `name` prop override.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The org dashboard's "Linha do tempo da organização" chart tooltip was
showing raw, unrounded decimals (e.g.
0.5860367647058823) forEstabilização and Adoção de IA instead of a rounded percentage.
Root cause: the tooltip
formattermatched itsnameargument againstdataKey strings (
"commits","stabilization","aiPctNorm"), but eachLine/Barsets an explicitnameprop (the translated label, e.g."Estabilização") for the legend. Recharts passes thatnamepropvalue to the formatter's
nameargument, not the dataKey — so thecomparison never matched and both series fell through to the raw,
unformatted value.
Fixed by matching on the payload entry's
dataKey(the formatter's thirdargument), which Recharts always populates regardless of any
nameprop override.
Test plan
npx tsc --noEmit— cleannpm run lint— cleannpm run test— 267/267 passing (no behavior covered by existingunit tests here; chart components aren't unit-tested per
platform/CLAUDE.md)confirm Estabilização/Adoção de IA show as rounded percentages (e.g.
59%) instead of raw decimals🤖 Generated with Claude Code