Skip to content

Omnidoc: Fix default values for Line, Scatter, CartesianGrid, ErrorBar, ReferenceArea, ReferenceDot#6665

Merged
ckifer merged 8 commits intomainfrom
default-values
Nov 21, 2025
Merged

Omnidoc: Fix default values for Line, Scatter, CartesianGrid, ErrorBar, ReferenceArea, ReferenceDot#6665
ckifer merged 8 commits intomainfrom
default-values

Conversation

@PavelVanecek
Copy link
Collaborator

@PavelVanecek PavelVanecek commented Nov 21, 2025

Description

Fixing documented default values.

ReferenceArea had animation props documented even though they do nothing so I removed it.

#6069

Summary by CodeRabbit

  • New Features

    • More configurable CartesianGrid (axis association, sync with ticks, point/fill options).
    • Richer Line and Scatter controls for animations, axes, z-order and styling.
    • ReferenceArea and ReferenceDot expose sizing and axis options.
    • ErrorBar default integration improved.
  • Bug Fixes

    • Unified animation defaults to a stable "auto" mode for predictable behavior.
    • Improved default-value validation and consistency.
  • Documentation

    • API docs and Storybook defaults updated to use proper native types and clearer controls.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 21, 2025

Walkthrough

Exports default props for multiple cartesian components, adds them to omnidoc mapping, updates component prop interfaces (JSDoc defaultValue annotations and some prop renames/typings), standardizes Storybook/API documented default values to native types, and updates tests and stories to match new defaults (notably isAnimationActive -> 'auto').

Changes

Cohort / File(s) Summary
Component default props exports
src/cartesian/CartesianGrid.tsx, src/cartesian/ErrorBar.tsx, src/cartesian/Line.tsx, src/cartesian/ReferenceArea.tsx, src/cartesian/ReferenceDot.tsx, src/cartesian/Scatter.tsx
Export default props constants; add JSDoc @defaultValue annotations and new optional props (axis IDs, zIndex, animation-related unions); rename rradius in ReferenceArea defaults; change some default values (e.g., CartesianGrid.zIndex -> -100, isAnimationActive -> 'auto').
Omnidoc integration
omnidoc/componentsAndDefaultPropsMap.ts, omnidoc/omnidoc.spec.ts
Add exported default-props entries (CartesianGrid, ErrorBar, Label, Line, ReferenceArea, ReferenceDot, Scatter) to componentMetaMap; make omnidoc tests object-aware (shallowEqual) and centralize default value stringification.
Selector logic
src/state/selectors/lineSelectors.ts
Tighten selectLinePoints early-return: also require layout to be horizontal or vertical before computing points.
Storybook argTypes / stories
storybook/stories/API/cartesian/CartesianGrid.stories.tsx, storybook/stories/API/cartesian/ReferenceArea.stories.tsx, storybook/stories/API/cartesian/Scatter.stories.tsx, storybook/stories/API/props/AnimationProps.ts, storybook/stories/API/props/CartesianComponentShared.ts, storybook/stories/API/props/RectangleProps.ts
Update argTypes (add axis IDs, syncWithTicks, zAxisId defaults), remove ReferenceArea animation controls, add/adjust defaultValue entries and control metadata, fix radius description typo.
API docs adjustments
www/src/docs/api/CartesianGrid.ts, www/src/docs/api/ErrorBar.ts, www/src/docs/api/Line.ts, www/src/docs/api/ReferenceArea.ts, www/src/docs/api/ReferenceDot.ts, www/src/docs/api/Scatter.ts, www/src/docs/api/types.ts
Convert defaultVal entries from string literals to native types (numbers, booleans, arrays), update isAnimationActive type/default to include 'auto', and expand ApiProps.defaultVal to allow arrays.
Tests updated
test/cartesian/Line.spec.tsx, test/cartesian/ReferenceArea.spec.tsx, test/component/Legend.itemSorter.spec.tsx, test/component/Legend.spec.tsx, test/component/Tooltip/Tooltip.visibility.spec.tsx
Adjust expectations to match new defaults: isAnimationActive'auto', add type: 'linear' where applicable, replace r assertions with radius, update radius values in ReferenceArea tests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas requiring extra attention:
    • omnidoc/omnidoc.spec.ts — verify object-aware comparisons and stringify helpers correctly handle scalar, array, and object defaults.
    • src/cartesian/Line.tsx and src/cartesian/Scatter.tsx — ensure isAnimationActive: 'auto' behavior preserves intended animation activation across SSR/CSR.
    • src/cartesian/ReferenceArea.tsx — verify rradius rename and the corrected conditional for yAxisScale are correct.
    • API/docs files (www/src/docs/api/*) — confirm defaultVal type conversions accurately reflect runtime defaults.

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • ckifer

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: fixing default values for six components, which is the primary objective of the PR.
Description check ✅ Passed The description is minimal but adequately conveys the purpose: fixing documented default values and removing ineffective animation props from ReferenceArea. However, it lacks detail on motivation, testing approach, and change categories.
✨ 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 default-values

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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/cartesian/ReferenceArea.tsx (1)

120-122: Fix broken y‑axis scale null‑check

if (xAxisScale == null || !yAxisScale == null) is logically incorrect: !yAxisScale == null is always false, so the guard never fires when yAxisScale is null/undefined, and subsequent code will try to use a missing scale.

This should guard both axes directly:

-  if (xAxisScale == null || !yAxisScale == null) {
+  if (xAxisScale == null || yAxisScale == null) {
     return null;
   }
🧹 Nitpick comments (7)
storybook/stories/API/props/RectangleProps.ts (2)

13-15: Consider control limitations for array values.

The control type 'number' allows users to input only a single number value, but the prop accepts number | number[]. Users won't be able to test array values (e.g., [10, 5, 15, 20] for individual corner radii) through the Storybook UI controls.

If array testing is important, consider using type: 'object' or type: 'text' with validation, though the current single-number control is still useful for the common case.


10-12: Optional: Minor grammar polish.

The description could be refined for clarity:

  • "If set to a value" (or "If a value is set")
  • "If set to an array" (or "If an array is set")
  • Consider "radii" instead of "radiuses" (both are valid, but radii is the more common plural)
src/cartesian/CartesianGrid.tsx (1)

91-112: JSDoc defaults and defaultCartesianGridProps are consistent and improve clarity

The added @defaultValue tags for grid visibility, points/fills, syncWithTicks, axis IDs, and z-index line up with defaultCartesianGridProps, and wiring them through resolveDefaultProps makes the defaults explicit and reusable.

One small maintainability nit: the JSDoc hard-codes @defaultValue -100 for zIndex while the actual default comes from DefaultZIndexes.grid. If DefaultZIndexes.grid ever changes, the doc could drift. Consider either referencing the constant in the comment or documenting it indirectly (e.g. “defaults to DefaultZIndexes.grid”) to avoid duplication.

Also applies to: 124-142, 147-172, 407-424

storybook/stories/API/props/AnimationProps.ts (1)

7-7: Animation arg defaults aligned with new semantics

  • Adding animateNewValues with defaultValue: true under the Animation category matches the intended default behavior.
  • Documenting isAnimationActive as defaulting to 'auto' with type: boolean | "auto" reflects the new “auto unless disabled” contract.

If you want slightly richer docs, you could also add a type or table.type.summary for animateNewValues, but that’s optional.

Also applies to: 29-32

omnidoc/omnidoc.spec.ts (1)

2-2: Consider dedicated equality library for test assertions.

Using shallowEqual from react-redux works, but it's primarily intended for React-Redux internals. Consider using a dedicated testing utility like lodash.isequal or implementing a custom shallow comparison for test assertions.

That said, since react-redux is already a dependency and shallowEqual provides the needed functionality, this is acceptable as-is.

src/cartesian/ReferenceArea.tsx (1)

25-49: ReferenceArea JSDoc defaults are consistent with the intended API

The added @defaultValue tags for ifOverflow, yAxisId, xAxisId, and zIndex correctly document the actual defaults (including zIndex = DefaultZIndexes.area = 100). Re‑declaring zIndex?: number on top of ZIndexable is slightly redundant but acceptable if you want per‑component docs.

src/cartesian/Line.tsx (1)

33-40: Layout typing and SVG props exclusions are tightened up

Importing CartesianLayout and using it in computeLinePoints, plus omitting layout from CurveProps in LineSvgProps, avoids leaking the internal layout prop into the public API and makes the layout contract explicit at the computation boundary. One minor follow‑up you might consider is changing InternalLineProps['layout'] to use CartesianLayout as well to keep the union definition centralized.

Also applies to: 200-200, 780-798

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 975caeb and 273e007.

⛔ Files ignored due to path filters (1)
  • test/cartesian/__snapshots__/ReferenceArea.spec.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (27)
  • omnidoc/componentsAndDefaultPropsMap.ts (2 hunks)
  • omnidoc/omnidoc.spec.ts (5 hunks)
  • src/cartesian/CartesianGrid.tsx (5 hunks)
  • src/cartesian/ErrorBar.tsx (1 hunks)
  • src/cartesian/Line.tsx (6 hunks)
  • src/cartesian/ReferenceArea.tsx (2 hunks)
  • src/cartesian/ReferenceDot.tsx (3 hunks)
  • src/cartesian/Scatter.tsx (3 hunks)
  • src/state/selectors/lineSelectors.ts (1 hunks)
  • storybook/stories/API/cartesian/CartesianGrid.stories.tsx (5 hunks)
  • storybook/stories/API/cartesian/ReferenceArea.stories.tsx (1 hunks)
  • storybook/stories/API/cartesian/Scatter.stories.tsx (4 hunks)
  • storybook/stories/API/props/AnimationProps.ts (1 hunks)
  • storybook/stories/API/props/CartesianComponentShared.ts (1 hunks)
  • storybook/stories/API/props/RectangleProps.ts (2 hunks)
  • test/cartesian/Line.spec.tsx (4 hunks)
  • test/cartesian/ReferenceArea.spec.tsx (4 hunks)
  • test/component/Legend.itemSorter.spec.tsx (4 hunks)
  • test/component/Legend.spec.tsx (4 hunks)
  • test/component/Tooltip/Tooltip.visibility.spec.tsx (1 hunks)
  • www/src/docs/api/CartesianGrid.ts (6 hunks)
  • www/src/docs/api/ErrorBar.ts (2 hunks)
  • www/src/docs/api/Line.ts (10 hunks)
  • www/src/docs/api/ReferenceArea.ts (3 hunks)
  • www/src/docs/api/ReferenceDot.ts (3 hunks)
  • www/src/docs/api/Scatter.ts (10 hunks)
  • www/src/docs/api/types.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-11-19T14:08:01.708Z
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6659
File: www/src/components/GuideView/Performance/index.tsx:232-250
Timestamp: 2025-11-19T14:08:01.708Z
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:

  • storybook/stories/API/cartesian/ReferenceArea.stories.tsx
  • storybook/stories/API/cartesian/Scatter.stories.tsx
📚 Learning: 2025-11-16T09:14:24.891Z
Learnt from: PavelVanecek
Repo: recharts/recharts PR: 6640
File: src/cartesian/Bar.tsx:156-159
Timestamp: 2025-11-16T09:14:24.891Z
Learning: In recharts, SSR (Server-Side Rendering) is not yet supported—charts don't render at all in SSR environments. The `isAnimationActive: 'auto'` mode is preparatory work for future SSR support, so testing of this mode should be deferred until SSR support is actually implemented.

Applied to files:

  • www/src/docs/api/Scatter.ts
  • www/src/docs/api/Line.ts
🧬 Code graph analysis (11)
storybook/stories/API/props/AnimationProps.ts (1)
storybook/StorybookArgs.ts (1)
  • StorybookArg (13-48)
omnidoc/omnidoc.spec.ts (1)
omnidoc/DocReader.ts (1)
  • DefaultValue (1-1)
src/state/selectors/lineSelectors.ts (1)
storybook/stories/API/props/CartesianComponentShared.ts (1)
  • layout (75-83)
www/src/docs/api/CartesianGrid.ts (1)
www/src/docs/api/types.ts (1)
  • ApiDoc (20-26)
src/cartesian/ReferenceArea.tsx (2)
src/util/IfOverflow.ts (1)
  • IfOverflow (1-1)
src/component/Label.tsx (1)
  • ImplicitLabelType (107-114)
storybook/stories/API/cartesian/CartesianGrid.stories.tsx (1)
src/cartesian/CartesianGrid.tsx (1)
  • CartesianGrid (426-555)
omnidoc/componentsAndDefaultPropsMap.ts (8)
src/cartesian/CartesianGrid.tsx (1)
  • defaultCartesianGridProps (407-424)
src/cartesian/ErrorBar.tsx (1)
  • errorBarDefaultProps (207-217)
src/component/Label.tsx (1)
  • defaultLabelProps (554-560)
src/cartesian/Line.tsx (1)
  • defaultLineProps (698-717)
src/cartesian/ReferenceArea.tsx (1)
  • referenceAreaDefaultProps (157-167)
src/cartesian/ReferenceDot.tsx (1)
  • referenceDotDefaultProps (158-168)
src/cartesian/ReferenceLine.tsx (1)
  • referenceLineDefaultProps (292-302)
src/cartesian/Scatter.tsx (1)
  • defaultScatterProps (704-721)
src/cartesian/CartesianGrid.tsx (1)
src/state/cartesianAxisSlice.ts (1)
  • AxisId (8-8)
storybook/stories/API/cartesian/Scatter.stories.tsx (1)
storybook/StorybookArgs.ts (1)
  • StorybookArgs (59-61)
src/cartesian/Line.tsx (5)
src/util/types.ts (5)
  • AnimationDuration (604-604)
  • AnimationTiming (602-602)
  • DataKey (59-59)
  • LegendType (68-79)
  • CartesianLayout (49-49)
src/component/LabelList.tsx (1)
  • ImplicitLabelListType (85-85)
src/shape/Curve.tsx (1)
  • CurveType (59-75)
src/state/cartesianAxisSlice.ts (1)
  • AxisId (8-8)
src/zIndex/DefaultZIndexes.tsx (1)
  • DefaultZIndexes (4-81)
src/cartesian/Scatter.tsx (4)
src/state/cartesianAxisSlice.ts (1)
  • AxisId (8-8)
src/util/types.ts (5)
  • DataKey (59-59)
  • LegendType (68-79)
  • TooltipType (80-80)
  • AnimationDuration (604-604)
  • AnimationTiming (602-602)
src/shape/Curve.tsx (1)
  • CurveType (59-75)
src/component/LabelList.tsx (1)
  • ImplicitLabelListType (85-85)
⏰ 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 (37)
storybook/stories/API/props/RectangleProps.ts (1)

10-10: LGTM! Good typo and grammar fixes.

The corrections improve the documentation quality: "rounderd" → "rounded" and "would falsely be add" → "would falsely be added".

Also applies to: 30-30

src/state/selectors/lineSelectors.ts (1)

102-103: LGTM! Defensive checks strengthen type safety.

The added guard conditions appropriately validate bandSize and layout before passing them to computeLinePoints. The layout check ensures only 'horizontal' or 'vertical' values proceed, while the bandSize null check prevents undefined/null from being passed downstream. These changes align well with the type updates mentioned in the AI summary.

storybook/stories/API/props/CartesianComponentShared.ts (1)

30-34: Aligning zAxisId default matches other axis defaults

Setting zAxisId.defaultValue to 0 keeps it consistent with xAxisId and yAxisId and with the unified cartesian defaults. Looks good.

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

1-3: CartesianGrid API defaults now match runtime props

Typing CartesianGridAPI as ApiDoc and switching defaultVal entries to real booleans/arrays/strings (horizontal/verticaltrue, points → [], fill'none') brings the docs in line with the actual defaultCartesianGridProps. This is a solid consistency fix.

Also applies to: 43-56, 63-66, 93-96, 123-126

test/component/Tooltip/Tooltip.visibility.spec.tsx (1)

768-799: Legend payload expectations updated for new Line defaults

Adjusting the expected legend payload to use isAnimationActive: 'auto' and type: 'linear' matches the new Line defaults and keeps this Tooltip-visibility selector test in sync with runtime behavior.

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

58-137: Legend.itemSorter tests now track Line’s new default props

Updating the expected legend payloads so Lines carry isAnimationActive: 'auto' and type: 'linear' keeps these itemSorter tests consistent with the new Line defaults and legend payload shape. Assertions remain focused on sort order while reflecting the updated metadata.

Also applies to: 151-231

test/cartesian/Line.spec.tsx (3)

302-337: onClick handler expectation correctly includes type: 'linear'

The click-event test now asserting type: 'linear' in the props passed to onClick aligns with Line’s new default type. This keeps the test in sync with the component’s public behavior.


340-405: Hover handlers also reflecting default line type

Both onMouseOver and onMouseOut expectations now include type: 'linear' in the argument object, which is consistent with the default Line configuration and the onClick test above.


408-446: Touch-event test updated for default type

Including type: 'linear' in the expected props for onTouchMove matches the other event tests and the Line default props, so the touch interaction coverage remains accurate.

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

419-512: Legend custom function payload now matches Line defaults

In the “content as a function” test, updating the expected payload entries to use isAnimationActive: 'auto' for both lines matches the new Line default animation mode and keeps the Legend payload contract consistent across tests.


772-857: Legend React-component payload expectations updated for isAnimationActive='auto'

The “content as a React Component” test now expecting isAnimationActive: 'auto' in the Line payload objects is consistent with the updated animation defaults and with the other Legend/Tooltip tests.

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

12-12: LGTM! Type expansion supports array default values.

The addition of Array<unknown> to the defaultVal type is necessary to support components with array defaults (e.g., CartesianGrid's horizontalPoints and verticalPoints).

src/cartesian/ErrorBar.tsx (1)

207-217: LGTM! Default props now publicly accessible for documentation.

Exporting errorBarDefaultProps aligns with the broader pattern across Cartesian components and enables automated documentation generation.

storybook/stories/API/cartesian/ReferenceArea.stories.tsx (1)

3-6: LGTM! Animation props correctly removed from ReferenceArea documentation.

The removal of animation-related imports aligns with the PR objective, as these props have no effect on ReferenceArea.

www/src/docs/api/ErrorBar.ts (2)

19-19: LGTM! Default value type now matches prop type.

Converting width default from string '5' to number 5 accurately reflects the actual type.


29-29: LGTM! Default value type now matches prop type.

Converting strokeWidth default from string '1.5' to number 1.5 accurately reflects the actual type.

omnidoc/omnidoc.spec.ts (3)

113-117: LGTM! Object comparison now handles array and object defaults.

The addition of object-aware comparison using shallowEqual properly handles array default values (e.g., [] for CartesianGrid's grid points).


128-137: LGTM! Enhanced error messages improve debugging.

The error messages now include both actual and documented values with their types, making it much easier to diagnose documentation inconsistencies.


160-179: LGTM! Standardized stringification improves comparison consistency.

The centralized stringify and stringifyDefaultValue helpers ensure consistent handling of default values across different documentation sources.

omnidoc/componentsAndDefaultPropsMap.ts (2)

8-13: LGTM! Default props imports enable documentation generation.

The new imports wire up the publicly exported default props from Cartesian components for documentation consistency checking.


23-30: LGTM! Component metadata map now includes all Cartesian components.

The additions to componentMetaMap enable automated default value consistency checking across API documentation, Storybook, and actual implementation.

storybook/stories/API/cartesian/Scatter.stories.tsx (3)

169-169: LGTM! Animation props now defined inline with Scatter-specific defaults.

Removing the generic animation props import and defining them inline (lines 339-350) correctly reflects Scatter's specific defaults (400ms duration, 'linear' easing) which differ from other components.


339-351: LGTM! Animation defaults match Scatter implementation.

The inline definitions correctly document Scatter's animation defaults: animationDuration: 400 and animationEasing: 'linear', matching defaultScatterProps in the implementation.


356-452: LGTM! Style prop defaults accurately documented.

All default values (legendType: 'circle', line: false, label: false, shape: 'circle', lineJointType: 'linear', lineType: 'joint') correctly reflect the actual implementation defaults in defaultScatterProps.

test/cartesian/ReferenceArea.spec.tsx (1)

336-376: Review comment is not applicable to the code.

These are two separate, independent test cases with intentionally different radius values. The test at line 326 ("should render rectangle when shape is not defined") uses radius={20} to verify DOM attribute rendering, while the test at line 468 ("should pass arguments to the shape function") uses radius={10} to verify that custom shape functions receive correct arguments. The spy expectation at line 484 correctly matches the radius={10} prop from line 475 in the same test. No inconsistency exists.

Likely an incorrect or invalid review comment.

src/cartesian/ReferenceDot.tsx (2)

22-57: ReferenceDot JSDoc defaults align with runtime behavior

The new JSDoc defaults for r, ifOverflow, xAxisId, and yAxisId are consistent with how the component behaves and with the new default props object. This keeps omnidoc and the runtime contract in sync.


158-177: Exported referenceDotDefaultProps is well‑typed and consistent

Exporting referenceDotDefaultProps with as const satisfies Partial<Props> is clean and keeps defaults (ifOverflow: 'discard', axis IDs 0, r: 10, styling, and zIndex) centralized and type‑checked. Usage via resolveDefaultProps in ReferenceDot and PropsWithDefaults fits the pattern used in other cartesian components.

src/cartesian/ReferenceArea.tsx (1)

157-167: Exported referenceAreaDefaultProps matches documented defaults

The exported referenceAreaDefaultProps (discard overflow, axis IDs 0, radius: 0, fill: '#ccc', fillOpacity: 0.5, stroke: 'none', strokeWidth: 1, zIndex: DefaultZIndexes.area) is coherent with the component’s behavior and the docs, and the as const satisfies Partial<Props> typing is appropriate.

storybook/stories/API/cartesian/CartesianGrid.stories.tsx (1)

7-143: CartesianGrid ArgTypes now mirror component defaults

Using CartesianGridArgTypes and documenting defaults for xAxisId, yAxisId, horizontalPoints, verticalPoints, and syncWithTicks brings Storybook in line with the runtime defaults from defaultCartesianGridProps, which is exactly what omnidoc‑style usage needs.

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

5-23: ReferenceDot docs defaults aligned with component defaults

xAxisId and yAxisId now default to 0, and ifOverflow to 'discard', which matches the exported referenceDotDefaultProps. This keeps the public docs consistent with the actual behavior.

Also applies to: 47-50

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

5-23: ReferenceArea docs now match runtime default props

The default values for xAxisId, yAxisId (both 0) and ifOverflow ('discard') correctly reflect referenceAreaDefaultProps, so the API docs and implementation are in sync.

Also applies to: 69-72

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

5-8: Scatter docs defaults updated to match component behavior and SSR plan

The updated defaults for legend/shape/line/lineType, axis IDs (0), and especially isAnimationActive: 'auto', animationDuration: 400, and animationEasing: 'linear' are consistent with the shared cartesian defaults strategy and the 'auto' animation mode being prepared for future SSR support. No further action needed here.

Also applies to: 15-38, 45-48, 68-105, 122-135

src/cartesian/Line.tsx (1)

124-195: Line JSDoc defaults correctly mirror defaultLineProps

The @defaultValue annotations on LineProps (animation flags/timings, connectNulls, dot, hide, isAnimationActive: 'auto', label, legendType: 'line', type: 'linear', axis IDs 0, zIndex: 400) all line up with the exported defaultLineProps. Exporting defaultLineProps with as const satisfies Partial<Props> gives a solid, type‑checked single source of truth for omnidoc and for resolveDefaultProps.

Also applies to: 698-717

www/src/docs/api/Line.ts (2)

10-10: LGTM! Default values properly typed.

The conversion from string representations to actual primitives (e.g., '0'0, 'true'true) improves the accuracy of the API documentation. The pattern is consistent: numbers and booleans use primitives, while string enum values remain as strings.

Also applies to: 41-41, 51-51, 61-61, 83-83, 107-107, 131-131, 155-155, 188-188


223-224: LGTM! Animation mode expanded for SSR preparation.

The type expansion to include "auto" and the updated default value align with the preparatory work for future SSR support. Based on learnings.

src/cartesian/Scatter.tsx (2)

155-155: LGTM! Animation mode expanded for SSR preparation.

The type expansion to boolean | 'auto' with default value 'auto' is consistent with the preparatory work for future SSR support. The change is properly reflected in both internal and external props. Based on learnings.

Also applies to: 219-222


170-238: LGTM! JSDoc annotations and default props export are well-aligned.

The JSDoc @defaultValue annotations provide helpful inline documentation, and the exported defaultScatterProps constant properly supports the omnidoc mapping mentioned in the PR objectives. All JSDoc values correctly match the defaultScatterProps values, with zIndex appropriately using the DefaultZIndexes.scatter constant (which resolves to 600 as documented).

Also applies to: 704-721

@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.04%. Comparing base (8439b4f) to head (2f3f237).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6665      +/-   ##
==========================================
- Coverage   94.26%   94.04%   -0.23%     
==========================================
  Files         496      497       +1     
  Lines       42442    42531      +89     
  Branches     4859     4859              
==========================================
- Hits        40009    39997      -12     
- Misses       2428     2529     +101     
  Partials        5        5              

☔ 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.

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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 273e007 and 2f3f237.

📒 Files selected for processing (2)
  • src/cartesian/ReferenceArea.tsx (3 hunks)
  • test/cartesian/ReferenceArea.spec.tsx (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • test/cartesian/ReferenceArea.spec.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
src/cartesian/ReferenceArea.tsx (2)
src/util/IfOverflow.ts (1)
  • IfOverflow (1-1)
src/component/Label.tsx (1)
  • ImplicitLabelType (107-114)
⏰ 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). (1)
  • GitHub Check: Build, Test, Pack
🔇 Additional comments (3)
src/cartesian/ReferenceArea.tsx (3)

25-27: LGTM! JSDoc default value annotations improve API documentation.

The added JSDoc @defaultValue annotations for ifOverflow, xAxisId, and yAxisId correctly match the actual default values defined in referenceAreaDefaultProps (lines 158-160).

Also applies to: 35-41


157-167: LGTM! Default props are now properly exported and aligned with component interfaces.

The export of referenceAreaDefaultProps improves API transparency. The change from r to radius (line 161) correctly aligns with the Rectangle component's prop interface, as confirmed by the related test updates mentioned in the PR summary.


45-48: JSDoc default value is correct.

Verification confirms that DefaultZIndexes.area equals 100, so the JSDoc annotation accurately documents the default value used at line 166.

const yAxisScale = useAppSelector(state => selectAxisScale(state, 'yAxis', yAxisId, isPanorama));

if (xAxisScale == null || !yAxisScale == null) {
if (xAxisScale == null || yAxisScale == null) {
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 | 🔴 Critical

Excellent fix for a critical operator precedence bug!

The corrected null check now properly validates that yAxisScale is null or undefined. The original condition !yAxisScale == null would have been evaluated as (!yAxisScale) == null, which always returns false because a boolean never equals null. This could have caused runtime errors when attempting to use a null scale downstream.

🤖 Prompt for AI Agents
In src/cartesian/ReferenceArea.tsx around line 120, the null check incorrectly
used '!yAxisScale == null' which evaluates as '(!yAxisScale) == null' and always
false; replace that expression with an explicit null/undefined check (use
'yAxisScale == null' to cover both null and undefined) so the condition reads
'if (xAxisScale == null || yAxisScale == null)' ensuring both scales are
properly validated before use.

@codecov
Copy link

codecov bot commented Nov 21, 2025

Bundle Report

Changes will increase total bundle size by 504 bytes (0.02%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
recharts/bundle-cjs 1.14MB 410 bytes (0.04%) ⬆️
recharts/bundle-es6 981.46kB 38 bytes (0.0%) ⬆️
recharts/bundle-umd 514.62kB 56 bytes (0.01%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: recharts/bundle-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
cartesian/Line.js 24 bytes 26.0kB 0.09%
cartesian/Scatter.js 31 bytes 24.02kB 0.13%
cartesian/CartesianGrid.js 80 bytes 16.55kB 0.49%
cartesian/ErrorBar.js 62 bytes 10.14kB 0.62%
cartesian/ReferenceArea.js 83 bytes 7.5kB 1.12%
cartesian/ReferenceDot.js 78 bytes 6.86kB 1.15%
state/selectors/lineSelectors.js 52 bytes 3.44kB 1.54%
view changes for bundle: recharts/bundle-umd

Assets Changed:

Asset Name Size Change Total Size Change (%)
Recharts.js 56 bytes 514.62kB 0.01%
view changes for bundle: recharts/bundle-es6

Assets Changed:

Asset Name Size Change Total Size Change (%)
cartesian/Line.js -23 bytes 24.39kB -0.09%
cartesian/Scatter.js -22 bytes 22.39kB -0.1%
cartesian/CartesianGrid.js 7 bytes 15.25kB 0.05%
cartesian/ErrorBar.js 7 bytes 9.13kB 0.08%
cartesian/ReferenceArea.js 10 bytes 6.34kB 0.16%
cartesian/ReferenceDot.js 7 bytes 5.73kB 0.12%
state/selectors/lineSelectors.js 52 bytes 3.18kB 1.66%

@ckifer ckifer merged commit e2cb758 into main Nov 21, 2025
28 of 29 checks passed
@PavelVanecek PavelVanecek deleted the default-values branch November 21, 2025 22:01
@coderabbitai coderabbitai bot mentioned this pull request Dec 6, 2025
@coderabbitai coderabbitai bot mentioned this pull request Jan 26, 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