Skip to content

[Omnidoc] Docs for Customized, Pie, PieChart, Legend, and LabelList#6787

Merged
ckifer merged 10 commits intomainfrom
omnidoc
Dec 18, 2025
Merged

[Omnidoc] Docs for Customized, Pie, PieChart, Legend, and LabelList#6787
ckifer merged 10 commits intomainfrom
omnidoc

Conversation

@PavelVanecek
Copy link
Collaborator

@PavelVanecek PavelVanecek commented Dec 17, 2025

Description

Also adds the "Deprecated" tag to the website, where used. And deprecates Customized component.

Also fixes builds (pnpm was missing from this repository CI script).

Related Issue

#6734

#6069

Summary by CodeRabbit

  • New Features

    • Added hide property to chart elements (Area, Bar, Line, Scatter, Pie) to control visibility while maintaining legend and axis impact.
    • Added zIndex property to labels for explicit layer control.
    • Enhanced Legend with new styling and layout options.
    • Made all event handlers optional for improved flexibility.
  • Deprecations

    • Customized component marked for removal in version 4.0.
  • Documentation

    • Expanded API documentation with detailed prop descriptions and deprecation notices.
    • Added context usage annotations for better component understanding.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 17, 2025

Walkthrough

This PR makes substantial API and documentation improvements across the library. It adds new public props to chart components (hide for Area/Bar/Line/Scatter/Pie), introduces deprecation metadata support to the omnidoc pipeline, refactors the type system to introduce BaseChartProps and make ExternalMouseEvents handlers optional, expands Legend and LabelList APIs, and migrates API documentation files from .ts to .tsx format while establishing new context consumption/provision annotations.

Changes

Cohort / File(s) Summary
CI/Build Setup
.github/workflows/ci.yml
Adds pnpm setup step (action-setup@v4) with Node 10 and caching before artifact downloads.
Omnidoc Core & Generation
omnidoc/componentsAndDefaultPropsMap.ts, omnidoc/generateApiDoc.ts, omnidoc/componentsWithInconsistentCommentsInApiDoc.ts
Adds LabelList to componentMetaMap; expands OMNIDOC_AUTOMATED_API_DOCS_COMPONENTS to include Customized, LabelList, Legend, Pie, PieChart; introduces per-prop and component-level deprecated field computation and emission; removes Customized from inconsistent comments list.
Omnidoc Tests & Validation
omnidoc/omnidoc.spec.ts, omnidoc/readProject.spec.ts, omnidoc/cross-component-prop-comments.spec.ts
Filters auto-generated components from API doc assertions; adds tests for Customized JSDoc and @deprecated tag parsing; expands cross-component exception list for height/width/layout/label/cx/cy/shape/content props.
Cartesian Components - Hide Prop
src/cartesian/Area.tsx, src/cartesian/Bar.tsx, src/cartesian/Line.tsx, src/cartesian/Scatter.tsx
Adds hide?: boolean prop to AreaProps, BarProps, ScatterProps; updates Line hide documentation to clarify graphical element hiding and axis domain impact.
Polar Components - Pie & Context Metadata
src/polar/Pie.tsx, src/polar/PieChart.tsx, src/polar/PolarGrid.tsx, src/polar/PolarAngleAxis.tsx, src/polar/PolarRadiusAxis.tsx, src/polar/Radar.tsx, src/polar/RadialBar.tsx
Expands Pie public API with animationBegin/Duration/Easing, data, dataKey, isAnimationActive, label, labelLine, legendType, maxRadius, minAngle, nameKey, shape, and event handlers; adds @consumes/@provides JSDoc annotations to Pie, Radar, RadialBar, and polar axis components.
Component Library Core
src/component/Label.tsx, src/component/LabelList.tsx, src/component/Legend.tsx, src/component/Customized.tsx, src/component/DefaultLegendContent.tsx, src/component/Tooltip.tsx
Adds zIndex prop to LabelList; expands Legend props to include wrapperStyle/width/height/verticalAlign and derives from DefaultLegendContentProps; extends DefaultLegendContent public API with content/iconSize/inactiveColor/formatter/event handlers and layout changes; adds deprecation/usage documentation to Customized; adds @consumes annotations to Tooltip.
Type System Refactoring
src/chart/types.ts, src/chart/RechartsWrapper.tsx, src/util/types.ts
Makes all ExternalMouseEvents handlers optional (onClick, onMouseLeave/Enter/Move/Down/Up, onContextMenu, onDoubleClick, onTouchStart/Move/End); removes Nullable type; introduces BaseChartProps with common chart props; refactors CartesianChartProps and PolarChartProps to extend BaseChartProps.
API Documentation Migration (Legend/Pie/LabelList/Customized)
www/src/docs/api/Legend.tswww/src/docs/api/LegendAPI.tsx, www/src/docs/api/Pie.tswww/src/docs/api/PieAPI.tsx, www/src/docs/api/LabelList.tswww/src/docs/api/LabelListAPI.tsx, www/src/docs/api/Customized.tswww/src/docs/api/CustomizedAPI.tsx, www/src/docs/api/index.ts
Removes API documentation constants from .ts files; creates new .tsx files with ApiDoc exports for Legend, Pie, LabelList, Customized; updates imports and allExamples mappings in index.ts.
API Documentation Updates
www/src/docs/api/AreaAPI.tsx, www/src/docs/api/LabelAPI.tsx, www/src/docs/api/LineAPI.tsx, www/src/docs/api/ScatterAPI.tsx, www/src/docs/api/PieChartAPI.tsx, www/src/docs/api/TextAPI.tsx, www/src/docs/api/types.ts
Adds desc for hide props with hiding/legend/axis domain semantics; enhances zIndex prop documentation with examples; updates formatter descriptions; adds PieChartAPI; widens deprecated type from boolean to boolean | string; adds deprecated field to ApiDoc.
Storybook Props & View Rendering
storybook/stories/API/props/LabelListProps.ts, www/src/views/APIViewNew.tsx
Removes defaultValue: null from LabelListProps content; adds conditional deprecation message rendering for props and component-level deprecated values.
Component Tests
test/component/Legend.itemSorter.spec.tsx, test/component/Legend.spec.tsx
Adds inactiveColor: '#ccc' to Legend content prop in test cases.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Type system refactoring (src/util/types.ts, src/chart/types.ts, src/chart/RechartsWrapper.tsx): Introduction of BaseChartProps and changes to ExternalMouseEvents optionality require careful verification of usage patterns and backward compatibility implications.
  • Omnidoc generation logic (omnidoc/generateApiDoc.ts): Deprecation metadata computation and prop-to-output mapping changes need validation across generated output.
  • API documentation migration (www/src/docs/api/*): Consistency of ApiDoc structure across newly migrated .tsx files and alignment with omnidoc generation pipeline.
  • Component prop additions and documentation (Area, Bar, Line, Scatter, Pie, Legend, LabelList): Verify that new hide/zIndex/verticalAlign/etc. props are correctly documented, default-valued, and tested across multiple files.
  • Test filtering logic (omnidoc tests): Verify OMNIDOC_AUTOMATED_API_DOCS_COMPONENTS filtering is applied consistently and correctly.

Possibly related PRs

Suggested reviewers

  • ckifer

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description lacks required template sections including Motivation and Context, How Has This Been Tested, and Types of changes checkboxes, though it does reference related issues. Complete the PR description by adding Motivation and Context, testing details, and marking appropriate change type checkboxes from the template.
Docstring Coverage ⚠️ Warning Docstring coverage is 58.82% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main objective: adding Omnidoc documentation for five key components (Customized, Pie, PieChart, Legend, LabelList).
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch omnidoc

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
www/src/docs/api/TextAPI.tsx (1)

170-171: Consider consistent ordering for union type values.

The union type values appear to be in an arbitrary order. Consider alphabetical ordering or placing the default value ('start') first for consistency with documentation conventions.

-      type: '"end" | "middle" | "inherit" | "start"',
+      type: '"start" | "end" | "middle" | "inherit"',
src/util/types.ts (1)

1164-1167: Consider using a generic type parameter or unknown[] instead of any[].

Per coding guidelines, any should be avoided. While chart data is intentionally flexible, using unknown[] or a generic like BaseChartProps<T = unknown> with data?: T[] would provide better type safety while preserving flexibility.

That said, this appears to be consolidating existing behavior, so this could be addressed in a follow-up.

-  /**
-   * The source data. Each element should be an object.
-   */
-  data?: any[];
+  /**
+   * The source data. Each element should be an object.
+   */
+  data?: unknown[];
www/src/docs/api/index.ts (1)

53-54: Inconsistent use of .tsx extension in imports.

These imports explicitly include the .tsx extension, while all other imports in this file omit the extension. Consider removing the extension for consistency:

-import { CustomizedAPI } from './CustomizedAPI.tsx';
-import { LabelListAPI } from './LabelListAPI.tsx';
+import { CustomizedAPI } from './CustomizedAPI';
+import { LabelListAPI } from './LabelListAPI';
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a48d2b1 and 304ee44.

📒 Files selected for processing (49)
  • .github/workflows/ci.yml (1 hunks)
  • omnidoc/componentsAndDefaultPropsMap.ts (1 hunks)
  • omnidoc/componentsWithInconsistentCommentsInApiDoc.ts (1 hunks)
  • omnidoc/cross-component-prop-comments.spec.ts (3 hunks)
  • omnidoc/generateApiDoc.ts (5 hunks)
  • omnidoc/omnidoc.spec.ts (3 hunks)
  • omnidoc/readProject.spec.ts (2 hunks)
  • src/cartesian/Area.tsx (1 hunks)
  • src/cartesian/Bar.tsx (1 hunks)
  • src/cartesian/Line.tsx (1 hunks)
  • src/cartesian/Scatter.tsx (3 hunks)
  • src/chart/PieChart.tsx (1 hunks)
  • src/chart/RechartsWrapper.tsx (1 hunks)
  • src/chart/SunburstChart.tsx (2 hunks)
  • src/chart/types.ts (1 hunks)
  • src/component/Customized.tsx (1 hunks)
  • src/component/DefaultLegendContent.tsx (3 hunks)
  • src/component/Label.tsx (2 hunks)
  • src/component/LabelList.tsx (2 hunks)
  • src/component/Legend.tsx (4 hunks)
  • src/component/Tooltip.tsx (1 hunks)
  • src/polar/Pie.tsx (3 hunks)
  • src/polar/PolarAngleAxis.tsx (1 hunks)
  • src/polar/PolarGrid.tsx (1 hunks)
  • src/polar/PolarRadiusAxis.tsx (1 hunks)
  • src/polar/Radar.tsx (1 hunks)
  • src/polar/RadialBar.tsx (1 hunks)
  • src/util/types.ts (2 hunks)
  • storybook/stories/API/props/LabelListProps.ts (0 hunks)
  • test/component/Legend.itemSorter.spec.tsx (2 hunks)
  • test/component/Legend.spec.tsx (2 hunks)
  • www/src/docs/api/AreaAPI.tsx (1 hunks)
  • www/src/docs/api/Customized.ts (0 hunks)
  • www/src/docs/api/CustomizedAPI.tsx (1 hunks)
  • www/src/docs/api/LabelAPI.tsx (2 hunks)
  • www/src/docs/api/LabelList.ts (0 hunks)
  • www/src/docs/api/LabelListAPI.tsx (1 hunks)
  • www/src/docs/api/Legend.ts (0 hunks)
  • www/src/docs/api/LegendAPI.tsx (1 hunks)
  • www/src/docs/api/LineAPI.tsx (1 hunks)
  • www/src/docs/api/Pie.ts (0 hunks)
  • www/src/docs/api/PieAPI.tsx (1 hunks)
  • www/src/docs/api/PieChart.ts (0 hunks)
  • www/src/docs/api/PieChartAPI.tsx (1 hunks)
  • www/src/docs/api/ScatterAPI.tsx (3 hunks)
  • www/src/docs/api/TextAPI.tsx (1 hunks)
  • www/src/docs/api/index.ts (4 hunks)
  • www/src/docs/api/types.ts (2 hunks)
  • www/src/views/APIViewNew.tsx (2 hunks)
💤 Files with no reviewable changes (6)
  • www/src/docs/api/PieChart.ts
  • www/src/docs/api/Customized.ts
  • www/src/docs/api/LabelList.ts
  • storybook/stories/API/props/LabelListProps.ts
  • www/src/docs/api/Pie.ts
  • www/src/docs/api/Legend.ts
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.{ts,tsx}: Never use any type (implicit or explicit) in TypeScript code
Prefer unknown over any and refine the type in TypeScript
Type function parameters and return values explicitly in TypeScript, do not rely on implicit any or inference; exceptions are React components and trivial functions
Do not use as type assertions in TypeScript; the only exception is as const

Files:

  • www/src/docs/api/CustomizedAPI.tsx
  • src/cartesian/Area.tsx
  • src/chart/PieChart.tsx
  • src/component/Tooltip.tsx
  • www/src/docs/api/LabelListAPI.tsx
  • src/cartesian/Bar.tsx
  • omnidoc/cross-component-prop-comments.spec.ts
  • omnidoc/componentsAndDefaultPropsMap.ts
  • src/cartesian/Scatter.tsx
  • omnidoc/componentsWithInconsistentCommentsInApiDoc.ts
  • src/polar/PolarGrid.tsx
  • omnidoc/readProject.spec.ts
  • src/component/Label.tsx
  • www/src/docs/api/PieAPI.tsx
  • test/component/Legend.spec.tsx
  • src/component/LabelList.tsx
  • www/src/docs/api/LegendAPI.tsx
  • src/cartesian/Line.tsx
  • src/polar/PolarRadiusAxis.tsx
  • www/src/docs/api/PieChartAPI.tsx
  • src/chart/RechartsWrapper.tsx
  • src/polar/RadialBar.tsx
  • www/src/docs/api/TextAPI.tsx
  • src/util/types.ts
  • src/chart/types.ts
  • src/chart/SunburstChart.tsx
  • www/src/docs/api/LabelAPI.tsx
  • src/polar/PolarAngleAxis.tsx
  • www/src/docs/api/AreaAPI.tsx
  • www/src/docs/api/LineAPI.tsx
  • www/src/docs/api/index.ts
  • www/src/docs/api/types.ts
  • test/component/Legend.itemSorter.spec.tsx
  • www/src/docs/api/ScatterAPI.tsx
  • src/component/DefaultLegendContent.tsx
  • src/component/Legend.tsx
  • src/component/Customized.tsx
  • omnidoc/omnidoc.spec.ts
  • omnidoc/generateApiDoc.ts
  • src/polar/Radar.tsx
  • www/src/views/APIViewNew.tsx
  • src/polar/Pie.tsx
**/*.{js,ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Ensure code lints by running npm run lint and follows Airbnb's Style Guide

Files:

  • www/src/docs/api/CustomizedAPI.tsx
  • src/cartesian/Area.tsx
  • src/chart/PieChart.tsx
  • src/component/Tooltip.tsx
  • www/src/docs/api/LabelListAPI.tsx
  • src/cartesian/Bar.tsx
  • omnidoc/cross-component-prop-comments.spec.ts
  • omnidoc/componentsAndDefaultPropsMap.ts
  • src/cartesian/Scatter.tsx
  • omnidoc/componentsWithInconsistentCommentsInApiDoc.ts
  • src/polar/PolarGrid.tsx
  • omnidoc/readProject.spec.ts
  • src/component/Label.tsx
  • www/src/docs/api/PieAPI.tsx
  • test/component/Legend.spec.tsx
  • src/component/LabelList.tsx
  • www/src/docs/api/LegendAPI.tsx
  • src/cartesian/Line.tsx
  • src/polar/PolarRadiusAxis.tsx
  • www/src/docs/api/PieChartAPI.tsx
  • src/chart/RechartsWrapper.tsx
  • src/polar/RadialBar.tsx
  • www/src/docs/api/TextAPI.tsx
  • src/util/types.ts
  • src/chart/types.ts
  • src/chart/SunburstChart.tsx
  • www/src/docs/api/LabelAPI.tsx
  • src/polar/PolarAngleAxis.tsx
  • www/src/docs/api/AreaAPI.tsx
  • www/src/docs/api/LineAPI.tsx
  • www/src/docs/api/index.ts
  • www/src/docs/api/types.ts
  • test/component/Legend.itemSorter.spec.tsx
  • www/src/docs/api/ScatterAPI.tsx
  • src/component/DefaultLegendContent.tsx
  • src/component/Legend.tsx
  • src/component/Customized.tsx
  • omnidoc/omnidoc.spec.ts
  • omnidoc/generateApiDoc.ts
  • src/polar/Radar.tsx
  • www/src/views/APIViewNew.tsx
  • src/polar/Pie.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (DEVELOPING.md)

All imports from recharts must use the public API entry point; imports from internal paths like recharts/types/* or recharts/src/* are not allowed

Files:

  • www/src/docs/api/CustomizedAPI.tsx
  • src/cartesian/Area.tsx
  • src/chart/PieChart.tsx
  • src/component/Tooltip.tsx
  • www/src/docs/api/LabelListAPI.tsx
  • src/cartesian/Bar.tsx
  • omnidoc/cross-component-prop-comments.spec.ts
  • omnidoc/componentsAndDefaultPropsMap.ts
  • src/cartesian/Scatter.tsx
  • omnidoc/componentsWithInconsistentCommentsInApiDoc.ts
  • src/polar/PolarGrid.tsx
  • omnidoc/readProject.spec.ts
  • src/component/Label.tsx
  • www/src/docs/api/PieAPI.tsx
  • test/component/Legend.spec.tsx
  • src/component/LabelList.tsx
  • www/src/docs/api/LegendAPI.tsx
  • src/cartesian/Line.tsx
  • src/polar/PolarRadiusAxis.tsx
  • www/src/docs/api/PieChartAPI.tsx
  • src/chart/RechartsWrapper.tsx
  • src/polar/RadialBar.tsx
  • www/src/docs/api/TextAPI.tsx
  • src/util/types.ts
  • src/chart/types.ts
  • src/chart/SunburstChart.tsx
  • www/src/docs/api/LabelAPI.tsx
  • src/polar/PolarAngleAxis.tsx
  • www/src/docs/api/AreaAPI.tsx
  • www/src/docs/api/LineAPI.tsx
  • www/src/docs/api/index.ts
  • www/src/docs/api/types.ts
  • test/component/Legend.itemSorter.spec.tsx
  • www/src/docs/api/ScatterAPI.tsx
  • src/component/DefaultLegendContent.tsx
  • src/component/Legend.tsx
  • src/component/Customized.tsx
  • omnidoc/omnidoc.spec.ts
  • omnidoc/generateApiDoc.ts
  • src/polar/Radar.tsx
  • www/src/views/APIViewNew.tsx
  • src/polar/Pie.tsx
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Do not hardcode any strings or formatting choices in library code; users should provide localized strings as desired

Files:

  • src/cartesian/Area.tsx
  • src/chart/PieChart.tsx
  • src/component/Tooltip.tsx
  • src/cartesian/Bar.tsx
  • src/cartesian/Scatter.tsx
  • src/polar/PolarGrid.tsx
  • src/component/Label.tsx
  • src/component/LabelList.tsx
  • src/cartesian/Line.tsx
  • src/polar/PolarRadiusAxis.tsx
  • src/chart/RechartsWrapper.tsx
  • src/polar/RadialBar.tsx
  • src/util/types.ts
  • src/chart/types.ts
  • src/chart/SunburstChart.tsx
  • src/polar/PolarAngleAxis.tsx
  • src/component/DefaultLegendContent.tsx
  • src/component/Legend.tsx
  • src/component/Customized.tsx
  • src/polar/Radar.tsx
  • src/polar/Pie.tsx
**/*.spec.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

When running unit tests, prefer to run a single test file using npm run test -- path/to/TestFile.spec.tsx rather than running all tests with npm test

Files:

  • omnidoc/cross-component-prop-comments.spec.ts
  • omnidoc/readProject.spec.ts
  • test/component/Legend.spec.tsx
  • test/component/Legend.itemSorter.spec.tsx
  • omnidoc/omnidoc.spec.ts
test/**/*.spec.{ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Aim for 100% unit test code coverage when writing new code

Files:

  • test/component/Legend.spec.tsx
  • test/component/Legend.itemSorter.spec.tsx
test/component/**/*.spec.tsx

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use React Testing Library for testing component interactions and behavior upon rendering

Files:

  • test/component/Legend.spec.tsx
  • test/component/Legend.itemSorter.spec.tsx
test/**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (test/README.md)

test/**/*.{test,spec}.{ts,tsx}: Aim for 100% unit test code coverage when writing new code
Prefer to use the createSelectorTestCase helper function when writing or modifying tests
Use the expectLastCalledWith helper function instead of expect(spy).toHaveBeenLastCalledWith(...) for better typing and autocompletion
Verify the number of selector calls using the spy object from createSelectorTestCase to spot unnecessary re-renders and improve performance
Mock getBoundingClientRect in tests using the helper function provided in test/helper/MockGetBoundingClientRect.ts
Use vi.useFakeTimers() in all tests due to Redux autoBatchEnhancer dependency on timers and requestAnimationFrame
Call vi.runOnlyPendingTimers() to advance timers after renders when not using createSelectorTestCase helper, and avoid vi.runAllTimers() to prevent infinite loops
Use userEvent.setup({ advanceTimers: vi.runOnlyPendingTimers }) or the userEventSetup helper function from test/helper/userEventSetup.ts when creating userEvent instances
When testing tooltips on hover, use vi.runOnlyPendingTimers() after each userEvent.hover() call or use the showTooltip helper function from tooltipTestHelpers.ts to account for requestAnimationFrame delays

Files:

  • test/component/Legend.spec.tsx
  • test/component/Legend.itemSorter.spec.tsx
🧠 Learnings (15)
📓 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-12-14T13:58:49.197Z
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6771
File: src/shape/Curve.tsx:39-40
Timestamp: 2025-12-14T13:58:49.197Z
Learning: In the recharts codebase, hooks like useAppSelector and other hooks (e.g., useChartLayout()) return undefined when used outside Redux Provider context, instead of throwing. This enables components that call these hooks, such as Curve, to operate in standalone mode by falling back to prop values. During code reviews, ensure TSX files gracefully handle undefined results from hooks and implement fallbacks (e.g., via default props or explicit prop-based values) rather than assuming the hook is always within Provider.

Applied to files:

  • src/cartesian/Area.tsx
  • src/chart/PieChart.tsx
  • src/component/Tooltip.tsx
  • src/cartesian/Bar.tsx
  • src/cartesian/Scatter.tsx
  • src/polar/PolarGrid.tsx
  • src/component/Label.tsx
  • src/component/LabelList.tsx
  • src/cartesian/Line.tsx
  • src/polar/PolarRadiusAxis.tsx
  • src/chart/RechartsWrapper.tsx
  • src/polar/RadialBar.tsx
  • src/chart/SunburstChart.tsx
  • src/polar/PolarAngleAxis.tsx
  • src/component/DefaultLegendContent.tsx
  • src/component/Legend.tsx
  • src/component/Customized.tsx
  • src/polar/Radar.tsx
  • src/polar/Pie.tsx
📚 Learning: 2025-11-23T13:30:10.395Z
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6669
File: www/src/docs/exampleComponents/ScatterChart/ScatterChartWithLabels.tsx:2-2
Timestamp: 2025-11-23T13:30:10.395Z
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/component/Tooltip.tsx
  • www/src/docs/api/PieChartAPI.tsx
  • src/chart/RechartsWrapper.tsx
  • src/util/types.ts
  • src/chart/types.ts
  • src/chart/SunburstChart.tsx
  • www/src/docs/api/index.ts
📚 Learning: 2025-11-25T01:23:08.250Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: test/README.md:0-0
Timestamp: 2025-11-25T01:23:08.250Z
Learning: Applies to test/**/*.{test,spec}.{ts,tsx} : When testing tooltips on hover, use `vi.runOnlyPendingTimers()` after each `userEvent.hover()` call or use the `showTooltip` helper function from `tooltipTestHelpers.ts` to account for requestAnimationFrame delays

Applied to files:

  • src/component/Tooltip.tsx
📚 Learning: 2025-12-14T13:58:58.361Z
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6771
File: src/shape/Curve.tsx:39-40
Timestamp: 2025-12-14T13:58:58.361Z
Learning: In the recharts codebase, `useAppSelector` and hooks like `useChartLayout()` are designed to return `undefined` when used outside Redux Provider context, rather than throwing errors. This allows components like `Curve` that call these hooks to work standalone by falling back to prop values.

Applied to files:

  • omnidoc/cross-component-prop-comments.spec.ts
  • www/src/docs/api/LegendAPI.tsx
  • www/src/docs/api/index.ts
📚 Learning: 2025-12-16T08:12:13.355Z
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6783
File: test/util/ChartUtils.spec.tsx:15-16
Timestamp: 2025-12-16T08:12:13.355Z
Learning: In the recharts codebase, files in the `test` folder are allowed to import from internal paths (e.g., `../../src/state/cartesianAxisSlice`) and do not need to use the public API entry point (`src/index.ts`). The public API import restriction applies only to non-test code.

Applied to files:

  • omnidoc/cross-component-prop-comments.spec.ts
  • omnidoc/readProject.spec.ts
  • www/src/docs/api/PieChartAPI.tsx
  • src/util/types.ts
  • www/src/docs/api/index.ts
📚 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:

  • omnidoc/cross-component-prop-comments.spec.ts
  • src/chart/RechartsWrapper.tsx
  • src/util/types.ts
  • src/chart/SunburstChart.tsx
  • src/component/Customized.tsx
📚 Learning: 2025-11-25T01:22:59.729Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-25T01:22:59.729Z
Learning: Applies to test/component/**/*.spec.tsx : Use React Testing Library for testing component interactions and behavior upon rendering

Applied to files:

  • omnidoc/readProject.spec.ts
📚 Learning: 2025-11-25T01:23:08.250Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: test/README.md:0-0
Timestamp: 2025-11-25T01:23:08.250Z
Learning: Applies to test/**/*.{test,spec}.{ts,tsx} : Verify the number of selector calls using the spy object from `createSelectorTestCase` to spot unnecessary re-renders and improve performance

Applied to files:

  • omnidoc/readProject.spec.ts
📚 Learning: 2025-11-25T01:23:08.250Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: test/README.md:0-0
Timestamp: 2025-11-25T01:23:08.250Z
Learning: Applies to test/**/*.{test,spec}.{ts,tsx} : Prefer to use the `createSelectorTestCase` helper function when writing or modifying tests

Applied to files:

  • omnidoc/readProject.spec.ts
📚 Learning: 2025-12-16T08:12:06.809Z
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6783
File: test/util/ChartUtils.spec.tsx:15-16
Timestamp: 2025-12-16T08:12:06.809Z
Learning: In tests (files under any test directory, e.g., test/, __tests__/, etc.), allow importing internal module paths (e.g., ../../src/...) and do not require imports to use the public API entry point (src/index.ts). The public API import restriction should apply only to non-test code. During reviews, accept internal imports in test files and enforce the public API pattern only for non-test code.

Applied to files:

  • test/component/Legend.spec.tsx
  • test/component/Legend.itemSorter.spec.tsx
📚 Learning: 2025-12-06T03:36:59.377Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: DEVELOPING.md:0-0
Timestamp: 2025-12-06T03:36:59.377Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : All imports from `recharts` must use the public API entry point; imports from internal paths like `recharts/types/*` or `recharts/src/*` are not allowed

Applied to files:

  • www/src/docs/api/PieChartAPI.tsx
  • src/chart/RechartsWrapper.tsx
  • src/util/types.ts
  • www/src/docs/api/index.ts
📚 Learning: 2025-11-25T01:22:59.729Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-25T01:22:59.729Z
Learning: Applies to storybook/stories/**/*.stories.tsx : Update Storybook stories when APIs have been changed to ensure they work as expected

Applied to files:

  • omnidoc/omnidoc.spec.ts
📚 Learning: 2025-11-25T01:22:59.729Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-25T01:22:59.729Z
Learning: Applies to storybook/stories/**/*.stories.tsx : Use Storybook for smoke tests and add play functions with assertions for actual tests

Applied to files:

  • omnidoc/omnidoc.spec.ts
📚 Learning: 2025-12-06T03:36:59.377Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: DEVELOPING.md:0-0
Timestamp: 2025-12-06T03:36:59.377Z
Learning: Applies to **/storybook/**/*.stories.{ts,tsx} : When adding new Storybook stories, prioritize high fidelity examples intended for publication on the website and in Storybook UI; use unit tests or VR tests for low fidelity tests

Applied to files:

  • omnidoc/omnidoc.spec.ts
🧬 Code graph analysis (15)
www/src/docs/api/CustomizedAPI.tsx (1)
www/src/docs/api/types.ts (1)
  • ApiDoc (21-28)
www/src/docs/api/LabelListAPI.tsx (1)
www/src/docs/api/types.ts (1)
  • ApiDoc (21-28)
omnidoc/componentsAndDefaultPropsMap.ts (1)
src/component/Label.tsx (1)
  • defaultLabelProps (607-613)
omnidoc/readProject.spec.ts (1)
test/helper/assertNotNull.ts (1)
  • assertNotNull (1-5)
www/src/docs/api/PieAPI.tsx (1)
www/src/docs/api/types.ts (1)
  • ApiDoc (21-28)
src/component/LabelList.tsx (1)
src/component/Label.tsx (1)
  • LabelFormatter (75-75)
www/src/docs/api/LegendAPI.tsx (1)
www/src/docs/api/types.ts (1)
  • ApiDoc (21-28)
www/src/docs/api/PieChartAPI.tsx (1)
www/src/docs/api/types.ts (1)
  • ApiDoc (21-28)
src/chart/RechartsWrapper.tsx (1)
src/chart/types.ts (1)
  • ExternalMouseEvents (8-53)
src/util/types.ts (2)
src/chart/types.ts (1)
  • ExternalMouseEvents (8-53)
src/synchronisation/types.ts (1)
  • SyncMethod (37-37)
src/component/DefaultLegendContent.tsx (1)
src/util/types.ts (2)
  • LegendType (81-92)
  • CartesianLayout (50-50)
src/component/Legend.tsx (1)
src/component/DefaultLegendContent.tsx (2)
  • Props (122-123)
  • VerticalAlignmentType (23-23)
omnidoc/omnidoc.spec.ts (1)
omnidoc/generateApiDoc.ts (1)
  • OMNIDOC_AUTOMATED_API_DOCS_COMPONENTS (24-39)
omnidoc/generateApiDoc.ts (2)
omnidoc/readProject.ts (1)
  • getTagText (27-37)
www/src/docs/api/types.ts (1)
  • ApiProps (10-19)
src/polar/Pie.tsx (2)
src/util/types.ts (5)
  • ActiveShape (1110-1115)
  • AnimationDuration (648-648)
  • AnimationTiming (646-646)
  • DataKey (65-65)
  • LegendType (81-92)
src/index.ts (4)
  • PieSectorDataItem (61-61)
  • DataKey (121-121)
  • PieLabel (59-59)
  • LegendType (121-121)
⏰ 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: Build, Test, Pack
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (62)
src/component/Tooltip.tsx (1)

182-185: LGTM! Documentation enhancement aligns with PR objectives.

The JSDoc annotation clearly documents the contexts consumed by this component, improving code maintainability and developer experience.

src/chart/SunburstChart.tsx (2)

86-89: LGTM! Consistent JSDoc formatting.

The added space before the closing */ improves consistency with standard JSDoc formatting conventions.


367-376: LGTM! Valid refactor removing unnecessary fragment.

The React fragment wrapper is unnecessary here since Surface already accepts multiple children (alongside Layer at line 366). Removing it simplifies the component structure without any functional impact.

.github/workflows/ci.yml (1)

201-206: Configuration is correct and fully compatible.

pnpm version 10.x requires Node.js at least v18.12, and the workflow uses Node.js 24.x, which exceeds this requirement. pnpm v10.24.0 is the latest stable release, and the combination has no known compatibility issues. The pnpm installation step is well-positioned, correctly configured with caching, and ready to proceed.

src/polar/PolarGrid.tsx (1)

165-168: LGTM!

The @consumes PolarViewBoxContext annotation accurately documents the component's dependency on the polar view box context, as evidenced by the useAppSelector(selectPolarViewBox) call at line 181. This aligns with the pattern being applied across other polar components in this PR.

src/polar/PolarRadiusAxis.tsx (1)

238-241: LGTM!

The @consumes PolarViewBoxContext annotation correctly documents that this component depends on the polar view box context. The actual consumption happens in PolarRadiusAxisWrapper via useAppSelector(selectPolarViewBox) at line 208, and documenting it on the public export is the appropriate approach.

src/cartesian/Scatter.tsx (3)

209-226: LGTM!

The documentation for the line prop is clear and comprehensive, with good examples and cross-references to the lineType prop and external documentation.


268-275: LGTM!

The enhanced description for activeShape now clearly explains the various activation triggers (mouse hover, touch, keyboard, programmatic), which improves API documentation clarity.


289-299: LGTM!

The new public hide prop is well-documented with clear explanation of its behavior regarding Legend visibility and axis domain calculations. The documentation is consistent with the same prop added to Area.tsx and aligns with the existing internal handling at line 152.

src/cartesian/Area.tsx (1)

196-206: LGTM!

The new public hide prop is properly documented with a clear explanation of the difference between hiding and removing an element. The documentation is consistent with the same prop added to Scatter.tsx, and the prop correctly defaults to false as defined in defaultAreaProps at line 855. The existing internal handling at line 794 already respects this prop.

src/polar/RadialBar.tsx (1)

658-661: LGTM!

The JSDoc annotations accurately document the context relationships. RadialBar provides LabelListContext via PolarLabelListContextProvider and consumes polar chart context through Redux selectors.

src/polar/Radar.tsx (1)

572-575: LGTM!

The JSDoc accurately documents the context relationships. Note that Radar provides CartesianLabelListContext (not PolarLabelListContext), but using the generic term "LabelListContext" appropriately abstracts this implementation detail.

src/cartesian/Bar.tsx (1)

180-188: LGTM!

The enhanced documentation clearly explains the difference between hiding and removing elements, and appropriately references the includeHidden prop for axis domain calculations. This is helpful for users understanding the behavior.

src/component/LabelList.tsx (2)

82-86: LGTM!

The documentation improvement clarifies that the content function is called once per item, which is helpful for understanding the rendering behavior.


111-121: Documentation is correct—no changes needed.

The documented default value of 2000 matches DefaultZIndexes.label, which is set to 2000 in src/zIndex/DefaultZIndexes.tsx line 80 and used as the default in LabelList.tsx line 179.

omnidoc/componentsAndDefaultPropsMap.ts (1)

52-52: The mapping of LabelList to defaultLabelProps is correct and intentional. LabelList accepts the same props as Label (angle, offset, position, textBreakAll, zIndex) and shares the same default values. The LabelList component internally manages how these defaults are applied—it wraps its content in a ZIndexLayer using the provided zIndex, then renders individual Label components with zIndex={0} to avoid portaling. No separate defaultLabelListProps is needed.

src/component/Label.tsx (1)

85-87: Formatter and zIndex docs look good; please verify default consistency

The new formatter description matches the existing getLabel behavior, and the expanded zIndex block correctly explains layering and portal behavior for Label. The only thing to double‑check is that DefaultZIndexes.label really is 2000, so the documented @defaultValue 2000 stays in sync with the actual default.

Also applies to: 138-147

www/src/docs/api/ScatterAPI.tsx (3)

13-16: Clarified activeShape activation description

The updated activeShape description correctly captures the various activation mechanisms (hover, touch, keyboard, programmatic) and matches how Scatter behaves in charts.


95-112: hide prop documentation matches component semantics

The new hide prop entry clearly explains that it hides the graphical element while keeping it in the Legend and (optionally) axis domain calculations via includeHidden on axes. This aligns well with the broader hide semantics used across components.


196-196: Minor copy fix for line prop description

Changing “Options"” to “Options:” improves readability and avoids the stray quote; no further changes needed.

src/polar/PolarAngleAxis.tsx (1)

325-327: Context-consumption annotation is accurate

The @consumes PolarViewBoxContext JSDoc accurately reflects that PolarAngleAxis depends on the polar view box from shared state/context, and brings this file in line with other annotated components.

src/chart/RechartsWrapper.tsx (1)

31-52: Simplified RechartsWrapperProps to extend ExternalMouseEvents directly

Using ExternalMouseEvents & { ... } now relies on the handlers being optional in ExternalMouseEvents, which matches the implementation and removes the extra Nullable<> indirection. This keeps the public prop type accurate without changing runtime behavior.

src/cartesian/Line.tsx (1)

196-203: hide JSDoc now accurately reflects legend and axis behavior

The expanded hide documentation matches how Line behaves: the graphical element is not rendered when hide is true, yet the legend entry remains (marked inactive) and axis-domain participation is controlled via includeHidden on X/Y axes. No code changes needed.

test/component/Legend.spec.tsx (1)

435-512: Tests correctly assert inactiveColor in Legend content props

Updating the expectations to include inactiveColor: '#ccc' in the arguments passed to function/Component content ensures the new Legend default is covered and that custom content can rely on this prop being present. The rest of the payload shape is unchanged.

Also applies to: 780-858

test/component/Legend.itemSorter.spec.tsx (1)

58-137: Legend.itemSorter tests now cover inactiveColor in content props

Including inactiveColor: '#ccc' in the expected Legend content props for both default sorting and itemSorter="dataKey" keeps these tests aligned with the new Legend default props and validates that custom content receives the inactive color as part of its inputs.

Also applies to: 152-232

www/src/docs/api/LineAPI.tsx (1)

146-151: Expanded Line.hide API docs align with component behavior

The updated hide description on the Line API page matches the JSDoc in Line.tsx and correctly explains Legend visibility and axis-domain implications via includeHidden on axes. This keeps the public docs consistent with runtime semantics.

www/src/docs/api/types.ts (1)

18-18: LGTM! Type extension supports richer deprecation metadata.

The change from boolean to boolean | string is backward compatible and enables deprecation messages with explanatory text. The implementation in www/src/views/APIViewNew.tsx correctly handles both types using typeof checks.

Also applies to: 27-27

src/chart/PieChart.tsx (1)

19-19: Good addition for API documentation clarity.

The @provides PolarChartContext annotation documents the context relationship, improving the generated API docs and helping developers understand component context consumption/provision patterns.

omnidoc/readProject.spec.ts (2)

19-19: LGTM! Correctly includes newly documented component.

Adding 'Customized' to the expected components list aligns with the PR's objective to document this component, even though it's deprecated.


1006-1030: Comprehensive test coverage for new deprecation features.

The new tests appropriately verify:

  • Component-level JSDoc and deprecation metadata reading
  • Prop-level deprecation tag handling
  • Correct primitive default value processing (without string wrappers)

The tests are well-structured and align with the expanded API documentation surface.

www/src/views/APIViewNew.tsx (2)

60-64: Prop deprecation message rendering is correct.

The type guard correctly checks for string deprecation values. Note that when deprecated is true (boolean), only the @deprecated label is shown (line 58) without an explanatory message. This is a reasonable design choice since the boolean form typically indicates "check the docs" rather than providing inline explanation.


209-213: Component deprecation notice correctly handles both boolean and string types.

The implementation properly:

  • Checks for any truthy deprecated value
  • Provides a fallback message when deprecated === true
  • Uses the custom deprecation message when it's a string
www/src/docs/api/AreaAPI.tsx (1)

139-156: Excellent documentation for the hide prop.

The description clearly explains:

  • What hiding does (hides graphical element)
  • Important nuances (still visible in Legend)
  • Related functionality (includeHidden on axes)

This will help developers understand the distinction between hiding and removing elements.

omnidoc/cross-component-prop-comments.spec.ts (4)

51-51: Appropriate exception for Legend's height/width props.

Legend's height and width refer to the legend container dimensions, which have different semantics than chart dimensions. This exception prevents false positives in cross-component consistency checks.

Also applies to: 56-56


75-79: Correct exception for Legend's layout prop.

Legend's layout prop controls internal item arrangement (horizontal/vertical), which differs semantically from chart layout props. The exception is well-justified.


121-125: Valid exceptions for Pie component's unique props.

Both exceptions are justified:

  • Pie's label implementation is unique due to arc positioning requirements
  • Pie's shape receives activeIndex for active slice highlighting, unlike other components

Also applies to: 137-140


127-135: Well-justified exceptions for cx/cy and content props.

Both exceptions document genuine behavioral differences:

  • Dot and SunburstChart's cx/cy don't support percentage values (unlike other components)
  • Label's content function is called once per Label (not once per data point like other components)

Also applies to: 142-145

www/src/docs/api/LegendAPI.tsx (3)

3-31: Well-structured Legend API documentation.

The align prop documentation is particularly clear, explaining:

  • Each alignment option's behavior
  • How it affects chart dimensions
  • Interaction with verticalAlign prop

This follows best practices for API documentation.


34-65: Good documentation with helpful examples.

The content and formatter props are clearly explained with practical examples. The CodeSandbox link in the formatter's format field provides valuable interactive documentation.


117-134: Excellent itemSorter documentation with important behavioral note.

The documentation clearly explains:

  • Default sorting behavior (by value/label)
  • Custom sorting options (dataKey, value, or function)
  • Critical warning about using null and potential render order instability

The parentComponents list appropriately includes all chart types that support Legend.

Also applies to: 419-419

omnidoc/omnidoc.spec.ts (1)

20-25: LGTM! Smart test optimization.

Filtering auto-generated components from consistency tests makes sense since they're generated directly from the project source and are guaranteed to match. This reduces test noise while maintaining coverage for manually maintained API docs.

Also applies to: 68-73, 176-182

www/src/docs/api/CustomizedAPI.tsx (1)

3-32: LGTM! Clear deprecation documentation.

The API documentation for the deprecated Customized component is well-structured with:

  • Clear migration guidance (Before/After examples)
  • Consistent deprecation messages at both prop and component levels
  • Explicit mention of removal timeline (version 4.0)
www/src/docs/api/LabelAPI.tsx (1)

144-161: LGTM! Comprehensive zIndex documentation.

The new zIndex prop is well-documented with:

  • Clear description of behavior and rendering order
  • Appropriate default value (2000)
  • Link to the zIndex guide for further reference
src/component/Customized.tsx (1)

12-17: LGTM! Consistent deprecation documentation.

The JSDoc deprecation tags are well-written with:

  • Clear explanation of why the component is no longer needed
  • Before/After migration examples
  • Explicit deprecation timeline (removal in 4.0)

This aligns perfectly with the API documentation in CustomizedAPI.tsx.

Also applies to: 22-29

www/src/docs/api/PieChartAPI.tsx (1)

3-277: LGTM! Comprehensive PieChart API documentation.

The API documentation is thorough and well-structured with:

  • Complete prop coverage including data, dimensions, margins, and event handlers
  • Detailed descriptions for key props (data, height, width, responsive, syncId, syncMethod)
  • Appropriate default values specified
  • Correct parent-child component relationships documented
www/src/docs/api/LabelListAPI.tsx (1)

3-165: LGTM! Well-documented LabelList API.

The API documentation is comprehensive with:

  • Detailed descriptions for key props (dataKey, content, valueAccessor)
  • Clear explanation of prop interactions (e.g., dataKey vs valueAccessor)
  • Consistent zIndex documentation matching Label component
  • Accurate parent component relationships
www/src/docs/api/PieAPI.tsx (3)

7-25: Good: activeShape deprecation is clearly documented.

The deprecation message provides clear migration guidance to use the shape prop with isActive instead.


150-167: Excellent hide prop documentation.

The description clearly explains the difference between hiding an element (still in Legend, can affect axis domain) versus removing it entirely. This nuance is important for users to understand.


3-673: LGTM! Comprehensive Pie API documentation.

The API documentation is thorough with:

  • Complete prop coverage including shape, data, angles, radii, labels, and extensive event handlers
  • Clear deprecation guidance for activeShape and inactiveShape
  • Detailed descriptions for complex props (label, labelLine, hide)
  • Accurate parent-child component relationships
omnidoc/generateApiDoc.ts (3)

24-39: LGTM! Expanded automated component list.

The addition of Customized, LabelList, Legend, Pie, and PieChart to the automated generation list aligns with the PR objectives.


243-266: Excellent deprecation extraction logic.

The implementation correctly:

  • Prefers deprecation metadata from recharts-origin props over DOM/inherited props
  • Falls back to checking all prop metadata sources if needed
  • Returns the deprecation text if available, or true if only the tag exists

This ensures accurate deprecation information even for props that may be inherited or overridden.


356-359: LGTM! Complete deprecation support.

The implementation properly handles deprecation at both levels:

  • Component-level: extracted from component JSDoc and included in ApiDoc
  • Prop-level: extracted from prop JSDoc and included in ApiProps
  • Both are correctly serialized to the generated output

The type safety is maintained with explicit string | boolean | undefined typing.

Also applies to: 431-433, 456-458

src/util/types.ts (1)

1143-1200: Good consolidation of shared chart props into BaseChartProps.

This refactoring eliminates duplication between CartesianChartProps and PolarChartProps by extracting common properties into a shared base interface. The JSDoc documentation is thorough and helpful.

Also applies to: 1202-1202, 1257-1257

src/component/Legend.tsx (2)

96-145: Well-documented Props type with clear JSDoc annotations.

The Props type correctly omits verticalAlign from DefaultLegendContentProps to re-declare it with a different default value (bottom vs middle). The JSDoc documentation clearly explains the behavior of each alignment option.


186-198: LGTM!

The inactiveColor default is consistent with DefaultLegendContent, and the @consumes annotations provide useful metadata for documentation generation.

www/src/docs/api/index.ts (1)

56-111: LGTM!

The export mappings correctly wire the new API documentation modules for PieChart, Legend, LabelList, Customized, and Pie.

src/component/DefaultLegendContent.tsx (2)

44-120: Comprehensive JSDoc documentation for DefaultLegendContentProps.

The documentation clearly explains each prop's purpose, includes practical examples, and links to external demos. The @defaultValue annotations properly match the actual defaults in defaultLegendContentDefaultProps.


137-154: LGTM!

The iconType parameter correctly uses LegendType | undefined, and the component properly handles the 'none' case at line 152-154 after the nullish coalescing fallback.

src/chart/types.ts (1)

8-53: LGTM - Making event handlers optional aligns with practical usage.

All event handlers in ExternalMouseEvents are now optional, which matches how users actually consume the API (providing only the handlers they need). This is a backward-compatible relaxation of the type constraint.

src/polar/Pie.tsx (3)

68-103: LGTM! Excellent documentation for PieDef properties.

The TSDoc comments clearly explain each property's purpose, including how percentage values are calculated and providing helpful examples with links.


287-310: Excellent comprehensive documentation for label and labelLine props.

The documentation thoroughly explains the different ways to use these props (boolean, object, ReactElement, function), provides clear examples, and links to live demonstrations. This will greatly improve the developer experience.


995-998: LGTM! Clear context consumption and provision annotations.

The @consumes and @provides annotations clearly document the component's context dependencies and what it provides to child components. This aligns with the implementation where PolarLabelListContextProvider is used (lines 816-819).

Comment on lines +6 to +9
/*
* CartesianAxis, Cell, Customized are deprecated and will be removed in 4.0
* so I will not put effort into documenting them.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Update comment to reflect that Customized is now documented.

The comment states "I will not put effort into documenting them," but the PR actually adds documentation for Customized (as stated in PR objectives and verified by tests in omnidoc/readProject.spec.ts lines 1006-1025). Consider updating the comment to clarify that Customized has been documented despite its deprecated status, or simply remove Customized from the comment.

🤖 Prompt for AI Agents
omnidoc/componentsWithInconsistentCommentsInApiDoc.ts around lines 6-9: the
block comment currently lists "CartesianAxis, Cell, Customized are deprecated
and will be removed in 4.0 so I will not put effort into documenting them," but
the PR adds documentation for Customized; update the comment to reflect that
Customized is documented (or remove Customized from the
deprecated-and-not-documented list). Edit the comment to either remove
"Customized" from the list or rephrase to explicitly note "Customized is
documented despite deprecation," keeping the rest of the comment unchanged.

Comment on lines +341 to +360
/**
* The customized event handler of mousedown on the sectors in this group.
*/
onMouseDown?: (data: any, index: number, e: React.MouseEvent) => void;
/**
* The customized event handler of mouseup on the sectors in this group.
*/
onMouseUp?: (data: any, index: number, e: React.MouseEvent) => void;
/**
* The customized event handler of mousemove on the sectors in this group.
*/
onMouseMove?: (data: any, index: number, e: React.MouseEvent) => void;
/**
* The customized event handler of mouseover on the sectors in this group.
*/
onMouseOver?: (data: any, index: number, e: React.MouseEvent) => void;
/**
* The customized event handler of mouseout on the sectors in this group.
*/
onMouseOut?: (data: any, index: number, e: React.MouseEvent) => void;
Copy link
Contributor

@coderabbitai coderabbitai bot Dec 17, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Replace any type with PieSectorDataItem in new event handler signatures.

The newly added event handlers (onMouseDown, onMouseUp, onMouseMove, onMouseOver, onMouseOut) use any for the data parameter, which violates the coding guideline prohibiting any types. The PieSectorDataItem type (defined at lines 178-182) is the appropriate type for sector data passed to these handlers.

As per coding guidelines, prefer unknown over any, or better yet, use the specific type PieSectorDataItem that already exists in this codebase.

Apply this diff to fix the type signatures:

   /**
    * The customized event handler of mousedown on the sectors in this group.
    */
-  onMouseDown?: (data: any, index: number, e: React.MouseEvent) => void;
+  onMouseDown?: (data: PieSectorDataItem, index: number, e: React.MouseEvent) => void;
   /**
    * The customized event handler of mouseup on the sectors in this group.
    */
-  onMouseUp?: (data: any, index: number, e: React.MouseEvent) => void;
+  onMouseUp?: (data: PieSectorDataItem, index: number, e: React.MouseEvent) => void;
   /**
    * The customized event handler of mousemove on the sectors in this group.
    */
-  onMouseMove?: (data: any, index: number, e: React.MouseEvent) => void;
+  onMouseMove?: (data: PieSectorDataItem, index: number, e: React.MouseEvent) => void;
   /**
    * The customized event handler of mouseover on the sectors in this group.
    */
-  onMouseOver?: (data: any, index: number, e: React.MouseEvent) => void;
+  onMouseOver?: (data: PieSectorDataItem, index: number, e: React.MouseEvent) => void;
   /**
    * The customized event handler of mouseout on the sectors in this group.
    */
-  onMouseOut?: (data: any, index: number, e: React.MouseEvent) => void;
+  onMouseOut?: (data: PieSectorDataItem, index: number, e: React.MouseEvent) => void;

Note: The existing onClick, onMouseEnter, and onMouseLeave handlers also use any and could benefit from the same fix, though they may have existed prior to this PR.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* The customized event handler of mousedown on the sectors in this group.
*/
onMouseDown?: (data: any, index: number, e: React.MouseEvent) => void;
/**
* The customized event handler of mouseup on the sectors in this group.
*/
onMouseUp?: (data: any, index: number, e: React.MouseEvent) => void;
/**
* The customized event handler of mousemove on the sectors in this group.
*/
onMouseMove?: (data: any, index: number, e: React.MouseEvent) => void;
/**
* The customized event handler of mouseover on the sectors in this group.
*/
onMouseOver?: (data: any, index: number, e: React.MouseEvent) => void;
/**
* The customized event handler of mouseout on the sectors in this group.
*/
onMouseOut?: (data: any, index: number, e: React.MouseEvent) => void;
/**
* The customized event handler of mousedown on the sectors in this group.
*/
onMouseDown?: (data: PieSectorDataItem, index: number, e: React.MouseEvent) => void;
/**
* The customized event handler of mouseup on the sectors in this group.
*/
onMouseUp?: (data: PieSectorDataItem, index: number, e: React.MouseEvent) => void;
/**
* The customized event handler of mousemove on the sectors in this group.
*/
onMouseMove?: (data: PieSectorDataItem, index: number, e: React.MouseEvent) => void;
/**
* The customized event handler of mouseover on the sectors in this group.
*/
onMouseOver?: (data: PieSectorDataItem, index: number, e: React.MouseEvent) => void;
/**
* The customized event handler of mouseout on the sectors in this group.
*/
onMouseOut?: (data: PieSectorDataItem, index: number, e: React.MouseEvent) => void;
🤖 Prompt for AI Agents
In src/polar/Pie.tsx around lines 341 to 360, the event handler signatures
currently use the `any` type for the `data` parameter; replace `any` with the
existing `PieSectorDataItem` type for `onMouseDown`, `onMouseUp`, `onMouseMove`,
`onMouseOver`, and `onMouseOut`. Update their signatures to `(data:
PieSectorDataItem, index: number, e: React.MouseEvent) => void` and also
consider changing `onClick`, `onMouseEnter`, and `onMouseLeave` to use
`PieSectorDataItem` for consistency. Ensure imports/types remain valid and run
TypeScript checks after the change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since it's been there on the other handlers as well, I will look into this in the next PR

Copy link
Contributor

Choose a reason for hiding this comment

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

@PavelVanecek, thank you for acknowledging this! That makes sense to fix all the event handler types together in a comprehensive update.

Would you like me to create a GitHub issue to track this type safety improvement for all the Pie event handlers?


🧠 Learnings used
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6750
File: src/state/selectors/axisSelectors.ts:593-602
Timestamp: 2025-12-08T08:23:26.261Z
Learning: In the recharts codebase, `DataKey<any>` is an intentional exception to the "no any" rule while proper typing is being developed. This should not be flagged in reviews.

Learnt from: CR
Repo: recharts/recharts PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-25T01:22:59.729Z
Learning: Applies to **/*.{ts,tsx} : Type function parameters and return values explicitly in TypeScript, do not rely on implicit any or inference; exceptions are React components and trivial functions

Learnt from: CR
Repo: recharts/recharts PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-25T01:22:59.729Z
Learning: Applies to **/*.{ts,tsx} : Prefer `unknown` over `any` and refine the type in TypeScript

Learnt from: CR
Repo: recharts/recharts PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-25T01:22:59.729Z
Learning: Applies to **/*.{ts,tsx} : Never use `any` type (implicit or explicit) in TypeScript code

@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

❌ Patch coverage is 99.60344% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.83%. Comparing base (a48d2b1) to head (304ee44).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
www/src/views/APIViewNew.tsx 33.33% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6787      +/-   ##
==========================================
+ Coverage   93.75%   93.83%   +0.08%     
==========================================
  Files         518      518              
  Lines       44094    44781     +687     
  Branches     5035     5037       +2     
==========================================
+ Hits        41340    42021     +681     
- Misses       2747     2753       +6     
  Partials        7        7              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Contributor

Staging Deployment Details

These deployments will remain available for 30 days.

To update snapshots: Comment /update-snapshots on this PR to automatically update the baseline screenshots.

<code>number</code>: the index of the field in the data;
</li>
<li>
<code>function</code>: a function that receives the data object and returns the value of each label.
Copy link
Member

Choose a reason for hiding this comment

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

eventually would be nice to add support for what the types look like for functions I think

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was looking for balance here, between information and too much detail. Whoever is interested in the exact type can open the IDE and hover over the prop.

Copy link
Member

Choose a reason for hiding this comment

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

yeah fair

@ckifer
Copy link
Member

ckifer commented Dec 18, 2025

some build errors?

@PavelVanecek
Copy link
Collaborator Author

I fixed those yesterday in the other PR. I was too lazy to rerun build here, I'm positive it will pass.

@PavelVanecek
Copy link
Collaborator Author

Also saving chromatic tokens 😅

@ckifer ckifer merged commit 7d15c13 into main Dec 18, 2025
40 of 43 checks passed
@ckifer ckifer deleted the omnidoc branch December 18, 2025 06:16
@coderabbitai coderabbitai bot mentioned this pull request Feb 15, 2026
7 tasks
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.

2 participants