Conversation
📝 WalkthroughWalkthroughA bounds-checking fix for the ChartValueBox component that clamps the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@front_end/src/components/charts/primitives/chart_value_box.tsx`:
- Around line 216-219: The right-side clamp currently uses textWidth (measured
from the chip label) which can allow the RESOLVED label to overflow when
hasResolution is true; update the clamp to base on the widest rendered label by
computing maxTextWidth = hasResolution ? Math.max(textWidth, resolvedLabelWidth)
: textWidth (use the actual variable name for the resolved label width in this
file), then replace textWidth in the Math.min expression with maxTextWidth so
the position calculation (using chartWidth, rightPadding, CHIP_OFFSET) prevents
overflow for either label.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ac01a32e-0df3-4d36-b216-75a2ca6aa3b7
📒 Files selected for processing (1)
front_end/src/components/charts/primitives/chart_value_box.tsx
| : Math.min( | ||
| chartWidth - rightPadding + textWidth / 2 + CHIP_OFFSET, | ||
| chartWidth - textWidth / 2 - 2 | ||
| ); |
There was a problem hiding this comment.
Clamp against the widest rendered label, not just displayText.
This cap only uses textWidth, which is measured from the lower chip text. When hasResolution is true, the separate RESOLVED label above can still overflow on the right if it is wider than the chip value, so the embed cutoff is only partially fixed here. Please base the clamp on the max width of both rendered texts.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@front_end/src/components/charts/primitives/chart_value_box.tsx` around lines
216 - 219, The right-side clamp currently uses textWidth (measured from the chip
label) which can allow the RESOLVED label to overflow when hasResolution is
true; update the clamp to base on the widest rendered label by computing
maxTextWidth = hasResolution ? Math.max(textWidth, resolvedLabelWidth) :
textWidth (use the actual variable name for the resolved label width in this
file), then replace textWidth in the Math.min expression with maxTextWidth so
the position calculation (using chartWidth, rightPadding, CHIP_OFFSET) prevents
overflow for either label.
Cleanup: Preview Environment RemovedThe preview environment for this PR has been destroyed.
Cleanup triggered by PR close at 2026-03-12T09:41:36Z |
This PR fixes the problem with label cutoff in embeds.
Before:
After:
Summary by CodeRabbit
Bug Fixes