Conversation
WalkthroughUpdates Bar component's generic type parameters, replacing default-type BarProps with explicit (DataPointType, ValueAxisType) parameters, converts Props to a generic type alias, and changes Bar export from ComponentType to a generic callable form. Adds comprehensive TypeScript typing tests for Bar validating strong typing scenarios. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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.
🧹 Nitpick comments (2)
test/cartesian/Bar/Bar.typed.spec.tsx (2)
64-285: Missingvi.useFakeTimers()— tests that render viarechartsTestRendermay be sensitive to timers.The coding guidelines require
vi.useFakeTimers()in all tests due to ReduxautoBatchEnhancerdependency on timers. WhileisAnimationActive={false}likely mitigates animation-related timer issues, theautoBatchEnhancerdependency could still cause flaky behavior. Consider adding abeforeEachwithvi.useFakeTimers().That said, the existing
Area.typed.spec.tsxfollows the same pattern without fake timers and appears to work, so this may be a pre-existing gap rather than something introduced here.Proposed fix
+import { beforeEach, describe, it, vi } from 'vitest'; -import { describe, it } from 'vitest'; import { Bar, BarChart, BarRectangleItem, getRelativeCoordinate } from '../../../src'; import { rechartsTestRender } from '../../helper/createSelectorTestCase'; import { expectBars, ExpectedBar } from '../../helper/expectBars'; ... describe('Bar with strong typing', () => { + beforeEach(() => { + vi.useFakeTimers(); + }); + describe('with all implicit types', () => {As per coding guidelines: "Use
vi.useFakeTimers()in all tests due to Redux autoBatchEnhancer dependency on timers andrequestAnimationFrame"
144-193: Consider converting commented-out tests to a TODO or tracked issue.These commented-out blocks document expected behavior if Bar supported
dataprop directly. While the explanatory comments are helpful, large commented-out code blocks can become stale. An alternative would be to track this as a GitHub issue and reference it here with a brief// TODO:comment.This is a minor nit — the comments are well-documented and the intent is clear.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7015 +/- ##
=======================================
Coverage 90.11% 90.11%
=======================================
Files 524 524
Lines 39073 39073
Branches 5399 5399
=======================================
Hits 35211 35211
Misses 3853 3853
Partials 9 9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Staging Deployment Details
These deployments will remain available for 30 days. To update snapshots: Comment |
Bundle ReportChanges will increase total bundle size by 148 bytes (0.01%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: recharts/bundle-es6Assets Changed:
view changes for bundle: recharts/bundle-cjsAssets Changed:
|
Description
Same as #6993 but for Bar
Summary by CodeRabbit
Refactor
Tests