Omnidoc: fix default values for polar charts, and Sankey#6682
Conversation
WalkthroughFour polar chart components (PieChart, RadarChart, RadialBarChart, Sankey) now export their default props constants. PolarChart exports Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ 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: 0
🧹 Nitpick comments (1)
storybook/stories/API/chart/Sankey.stories.tsx (1)
16-16: Address TODO comments for link and node descriptions.The
linkandnodeproperties are missing descriptions in the Storybook argTypes. Based on the API documentation inwww/src/docs/api/Sankey.ts(lines 114-128), these should document that they can be either objects for configuration or ReactElements for custom rendering.Do you want me to generate the descriptions for these properties based on the API documentation?
Also applies to: 27-27
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
omnidoc/componentsAndDefaultPropsMap.ts(2 hunks)src/chart/PieChart.tsx(1 hunks)src/chart/PolarChart.tsx(3 hunks)src/chart/RadarChart.tsx(1 hunks)src/chart/RadialBarChart.tsx(1 hunks)src/chart/Sankey.tsx(1 hunks)storybook/stories/API/chart/Sankey.stories.tsx(1 hunks)www/src/docs/api/PieChart.ts(1 hunks)www/src/docs/api/RadarChart.ts(7 hunks)www/src/docs/api/RadialBarChart.ts(6 hunks)www/src/docs/api/Sankey.ts(6 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6659
File: www/src/components/GuideView/Performance/index.tsx:232-250
Timestamp: 2025-11-19T14:08:01.728Z
Learning: In Recharts version 3.4.2, object-as-prop optimizations were introduced to reduce unnecessary re-renders when new object references are passed as props. This affects the recommendation for the `react-perf/jsx-no-new-object-as-prop` ESLint rule.
📚 Learning: 2025-11-19T14:08:01.728Z
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6659
File: www/src/components/GuideView/Performance/index.tsx:232-250
Timestamp: 2025-11-19T14:08:01.728Z
Learning: In Recharts version 3.4.2, object-as-prop optimizations were introduced to reduce unnecessary re-renders when new object references are passed as props. This affects the recommendation for the `react-perf/jsx-no-new-object-as-prop` ESLint rule.
Applied to files:
src/chart/RadarChart.tsxsrc/chart/PolarChart.tsxsrc/chart/RadialBarChart.tsx
📚 Learning: 2025-11-23T13:30:10.388Z
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6669
File: www/src/docs/exampleComponents/ScatterChart/ScatterChartWithLabels.tsx:2-2
Timestamp: 2025-11-23T13:30:10.388Z
Learning: The `TooltipIndex` type from recharts is defined in `src/state/tooltipSlice.ts` but is not currently exported from the public API entry points. It should not be imported from `recharts/types/state/tooltipSlice` as this is an internal implementation path. An ESLint rule is needed to prevent regressions.
Applied to files:
src/chart/RadarChart.tsxsrc/chart/RadialBarChart.tsxsrc/chart/PieChart.tsx
🧬 Code graph analysis (5)
src/chart/RadarChart.tsx (3)
src/util/types.ts (2)
TooltipEventType(927-927)PolarChartProps(1147-1188)src/chart/PolarChart.tsx (1)
defaultPolarChartProps(19-33)src/util/resolveDefaultProps.tsx (1)
resolveDefaultProps(16-53)
omnidoc/componentsAndDefaultPropsMap.ts (4)
src/chart/PieChart.tsx (1)
defaultPieChartProps(10-15)src/chart/RadarChart.tsx (1)
defaultRadarChartProps(10-15)src/chart/RadialBarChart.tsx (1)
defaultRadialBarChartProps(10-15)src/chart/Sankey.tsx (1)
sankeyDefaultProps(840-851)
src/chart/RadialBarChart.tsx (3)
src/util/types.ts (2)
TooltipEventType(927-927)PolarChartProps(1147-1188)src/chart/PolarChart.tsx (1)
defaultPolarChartProps(19-33)src/util/resolveDefaultProps.tsx (1)
resolveDefaultProps(16-53)
storybook/stories/API/chart/Sankey.stories.tsx (1)
storybook/StorybookArgs.ts (1)
StorybookArgs(59-61)
src/chart/PieChart.tsx (3)
src/util/types.ts (2)
TooltipEventType(927-927)PolarChartProps(1147-1188)src/chart/PolarChart.tsx (1)
defaultPolarChartProps(19-33)src/util/resolveDefaultProps.tsx (1)
resolveDefaultProps(16-53)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Build, Test, Pack
🔇 Additional comments (18)
src/chart/PolarChart.tsx (2)
19-33: LGTM: Public default props export.The exported
defaultPolarChartPropsenables composition by downstream chart components and provides a centralized, type-safe source of default values for polar charts. The defaults forcx,cy,innerRadius, andouterRadiusare appropriate.
69-69: LGTM: Consistent usage of exported defaults.The chart correctly uses the newly exported
defaultPolarChartPropsfor default prop resolution.www/src/docs/api/RadialBarChart.ts (1)
34-34: LGTM: Documentation defaults align with implementation.The updated
defaultValentries correctly reflect the defaults fromdefaultRadialBarChartProps(which composesdefaultPolarChartProps).Also applies to: 45-45, 65-65, 76-76, 107-107, 119-119
src/chart/PieChart.tsx (2)
10-15: LGTM: Proper composition of default props.The
defaultPieChartPropscorrectly composesdefaultPolarChartPropsand adds PieChart-specific defaults. Thelayout: 'centric'override is appropriate for pie charts.
18-18: LGTM: Consistent prop resolution.The chart correctly uses the composed
defaultPieChartPropsfor default prop resolution.src/chart/RadialBarChart.tsx (2)
10-15: LGTM: Proper composition of default props.The
defaultRadialBarChartPropscorrectly composesdefaultPolarChartPropsand adds RadialBarChart-specific defaults.
18-18: LGTM: Consistent prop resolution.The chart correctly uses the composed
defaultRadialBarChartProps.src/chart/RadarChart.tsx (2)
10-15: LGTM: Proper composition with radar-specific angles.The
defaultRadarChartPropscorrectly composesdefaultPolarChartPropswith radar-specific angle defaults (startAngle: 90, endAngle: -270).
18-18: LGTM: Consistent prop resolution.The chart correctly uses the composed
defaultRadarChartProps.www/src/docs/api/PieChart.ts (1)
25-25: LGTM: Documentation margin default updated.The updated
margindefaultVal correctly reflects the default fromdefaultPolarChartProps(inherited bydefaultPieChartProps).omnidoc/componentsAndDefaultPropsMap.ts (2)
29-32: LGTM: Imports for new default props exports.The imports correctly reference the newly exported default props constants.
54-54: LGTM: Public API mapping extended.The
componentMetaMapis correctly extended to expose the new default props for PieChart, RadarChart, RadialBarChart, and Sankey, enabling documentation generation and public API access.Also applies to: 58-58, 60-60, 65-65
src/chart/Sankey.tsx (2)
840-851: LGTM: Sankey default props exported.The
sankeyDefaultPropsis now exported for public API access and documentation generation. The addition ofalign: 'justify'as a default is consistent with the function signature at line 343.
995-995: LGTM: Consistent usage of exported defaults.The Sankey component correctly uses the exported
sankeyDefaultPropsfor default prop resolution.storybook/stories/API/chart/Sankey.stories.tsx (1)
10-60: LGTM! Well-structured argTypes definition.The
SankeyArgTypesconstant provides comprehensive documentation for Sankey chart properties. The default values are consistent with the API documentation and properly formatted for Storybook display.www/src/docs/api/Sankey.ts (2)
67-67: LGTM! Proper type representation for default values.The default values have been correctly updated from string representations to proper types:
sort: string'true'→ booleantruenodePadding: string'10'→ number10nodeWidth: string'10'→ number10linkCurvature: string'0.5'→ number0.5iterations: string'32'→ number32This improves the accuracy of the API documentation.
Also applies to: 76-76, 85-85, 94-94, 103-103
164-172: No issues found - align property is correctly documented.Verification confirms the
alignproperty documentation at lines 164-172 is accurate. The default value'justify'matches thesankeyDefaultPropsconstant insrc/chart/Sankey.tsx:841, the type specification'left' | 'justify'is correct, and the property is properly marked as optional with a clear description.www/src/docs/api/RadarChart.ts (1)
38-38: All documented default values match the source code.Verification confirms that all default values in the documentation (lines 38, 49, 60, 70, 82, 94, 106) correctly reflect the actual
defaultRadarChartPropsanddefaultPolarChartPropsexported fromsrc/chart/RadarChart.tsxandsrc/chart/PolarChart.tsx. No discrepancies found.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6682 +/- ##
==========================================
- Coverage 94.02% 94.02% -0.01%
==========================================
Files 499 499
Lines 42575 42547 -28
Branches 4873 4873
==========================================
- Hits 40032 40004 -28
Misses 2538 2538
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Bundle ReportChanges will increase total bundle size by 11.57kB (0.44%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: recharts/bundle-umdAssets Changed:
view changes for bundle: recharts/bundle-es6Assets Changed:
view changes for bundle: recharts/bundle-cjsAssets Changed:
|
Related Issue
#6069
Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.