Skip to content

Reducing storybooks#6681

Merged
PavelVanecek merged 8 commits into
mainfrom
less-storybooks
Nov 24, 2025
Merged

Reducing storybooks#6681
PavelVanecek merged 8 commits into
mainfrom
less-storybooks

Conversation

@PavelVanecek

@PavelVanecek PavelVanecek commented Nov 24, 2025

Copy link
Copy Markdown
Collaborator

Description

I found and removed some stories that were duplicated (present in both API and Examples, or present in both Line and LineChart sections)

Related Issue

#6668

Summary by CodeRabbit

  • New Features

    • Added label property to RadialBar component for enhanced customization.
  • Documentation

    • Added Legend component example to RadarChart documentation.
  • Tests

    • Added visual regression tests for CartesianAxis and RadarChart components to improve stability.

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

@coderabbitai

coderabbitai Bot commented Nov 24, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This PR adds a public label prop to RadialBar, introduces Legend in RadarChart stories, removes multiple Storybook story definitions and files across Examples folder, and adds new visual regression tests for CartesianAxis and RadarChart with various configurations.

Changes

Cohort / File(s) Summary
Source library changes
src/polar/RadialBar.tsx
Added public prop label?: ImplicitLabelListType to InternalRadialBarProps interface with default value of false.
Story updates
storybook/stories/API/chart/RadarChart.stories.tsx
Added Legend component import and integrated Legend instance into RadarChart Simple story render tree.
Tiny story removals
storybook/stories/Examples/AreaChart.stories.tsx, storybook/stories/Examples/BarChart/BarChart.stories.tsx, storybook/stories/Examples/LineChart/LineChart.stories.tsx
Removed TinyAreaChart, Tiny, and Tiny story exports respectively from area, bar, and line chart story files.
RadarChart story removals
storybook/stories/Examples/RadarChart.stories.tsx
Removed four exported stories: NumberAngleType, CategoryAngleType, ShouldBeCorrectAngle, and RadarWithLegend.
LineChart story logic update
storybook/stories/Examples/LineChart/LineChart.stories.tsx
Updated dot customization condition in WithCustomizedDot story from value > 2500 to value >= 800 for broader red dot rendering.
Deleted Storybook story files
storybook/stories/Examples/cartesian/Bar/CustomizedShape.stories.tsx, storybook/stories/Examples/cartesian/Bar/StackedAndUnstacked.stories.tsx, storybook/stories/Examples/cartesian/CartesianAxis/MultipleAxes.stories.tsx, storybook/stories/Examples/cartesian/Line/LineWithCustomDot.stories.tsx, storybook/stories/Examples/cartesian/Line/LineWithCustomLabel.stories.tsx
Removed entire story files containing custom shape, stacked bar, multiple axes, custom dot, and custom label examples respectively.
New VR test files
test-vr/tests/CartesianAxis/CartesianAxis.multi.spec-vr.tsx, test-vr/tests/RadarChart/RadarChart.datatypes.spec-vr.tsx
Added Playwright-based visual regression tests for CartesianAxis with multiple orientations and RadarChart with various angle domain types and data configurations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • The logic threshold change in LineChart.stories.tsx (from value > 2500 to value >= 800) should be verified for correctness and intent
  • The new VR test files should be checked for proper Playwright setup, mocking, and assertion patterns
  • Confirm all removed stories (5 complete file deletions + multiple story removals) are intentional cleanup and not breaking dependencies

Possibly related PRs

Suggested reviewers

  • ckifer

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Reducing storybooks' is vague and generic, using a non-descriptive term that doesn't convey meaningful information about which stories were removed or why. Use a more specific title like 'Remove duplicate storybook stories' or 'Clean up duplicate stories in API and Examples sections' to clearly indicate the main change.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description identifies the change (removing duplicate stories) and references the related issue #6668, but is missing required template sections including Motivation and Context, How Has This Been Tested, and Types of changes checkboxes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 less-storybooks

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 04e10a8 and 9dd8aff.

⛔ Files ignored due to path filters (16)
  • package-lock.json is excluded by !**/package-lock.json
  • test-vr/__snapshots__/tests/CartesianAxis/CartesianAxis.multi.spec-vr.tsx-snapshots/CartesianAxis-Multiple-Axes-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/CartesianAxis/CartesianAxis.multi.spec-vr.tsx-snapshots/CartesianAxis-Multiple-Axes-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/CartesianAxis/CartesianAxis.multi.spec-vr.tsx-snapshots/CartesianAxis-Multiple-Axes-1-webkit-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadarChart/RadarChart.datatypes.spec-vr.tsx-snapshots/category-angle-type-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadarChart/RadarChart.datatypes.spec-vr.tsx-snapshots/category-angle-type-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadarChart/RadarChart.datatypes.spec-vr.tsx-snapshots/category-angle-type-1-webkit-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadarChart/RadarChart.datatypes.spec-vr.tsx-snapshots/number-angle-type-with-default-domain-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadarChart/RadarChart.datatypes.spec-vr.tsx-snapshots/number-angle-type-with-default-domain-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadarChart/RadarChart.datatypes.spec-vr.tsx-snapshots/number-angle-type-with-default-domain-1-webkit-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadarChart/RadarChart.datatypes.spec-vr.tsx-snapshots/number-angle-type-with-explicit-domain-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadarChart/RadarChart.datatypes.spec-vr.tsx-snapshots/number-angle-type-with-explicit-domain-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadarChart/RadarChart.datatypes.spec-vr.tsx-snapshots/number-angle-type-with-explicit-domain-1-webkit-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadarChart/RadarChart.datatypes.spec-vr.tsx-snapshots/should-be-correct-angle-with-odd-number-of-points-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadarChart/RadarChart.datatypes.spec-vr.tsx-snapshots/should-be-correct-angle-with-odd-number-of-points-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadarChart/RadarChart.datatypes.spec-vr.tsx-snapshots/should-be-correct-angle-with-odd-number-of-points-1-webkit-linux.png is excluded by !**/*.png
📒 Files selected for processing (13)
  • src/polar/RadialBar.tsx (1 hunks)
  • storybook/stories/API/chart/RadarChart.stories.tsx (2 hunks)
  • storybook/stories/Examples/AreaChart.stories.tsx (0 hunks)
  • storybook/stories/Examples/BarChart/BarChart.stories.tsx (0 hunks)
  • storybook/stories/Examples/LineChart/LineChart.stories.tsx (1 hunks)
  • storybook/stories/Examples/RadarChart.stories.tsx (0 hunks)
  • storybook/stories/Examples/cartesian/Bar/CustomizedShape.stories.tsx (0 hunks)
  • storybook/stories/Examples/cartesian/Bar/StackedAndUnstacked.stories.tsx (0 hunks)
  • storybook/stories/Examples/cartesian/CartesianAxis/MultipleAxes.stories.tsx (0 hunks)
  • storybook/stories/Examples/cartesian/Line/LineWithCustomDot.stories.tsx (0 hunks)
  • storybook/stories/Examples/cartesian/Line/LineWithCustomLabel.stories.tsx (0 hunks)
  • test-vr/tests/CartesianAxis/CartesianAxis.multi.spec-vr.tsx (1 hunks)
  • test-vr/tests/RadarChart/RadarChart.datatypes.spec-vr.tsx (1 hunks)
💤 Files with no reviewable changes (8)
  • storybook/stories/Examples/BarChart/BarChart.stories.tsx
  • storybook/stories/Examples/AreaChart.stories.tsx
  • storybook/stories/Examples/cartesian/CartesianAxis/MultipleAxes.stories.tsx
  • storybook/stories/Examples/cartesian/Bar/StackedAndUnstacked.stories.tsx
  • storybook/stories/Examples/cartesian/Bar/CustomizedShape.stories.tsx
  • storybook/stories/Examples/cartesian/Line/LineWithCustomDot.stories.tsx
  • storybook/stories/Examples/cartesian/Line/LineWithCustomLabel.stories.tsx
  • storybook/stories/Examples/RadarChart.stories.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
test-vr/tests/CartesianAxis/CartesianAxis.multi.spec-vr.tsx (1)
storybook/stories/data/Tick.ts (1)
  • ticks (16-16)
⏰ 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 (5)
storybook/stories/API/chart/RadarChart.stories.tsx (1)

4-22: Legend usage in Simple RadarChart story looks correct

Importing Legend from the local src and rendering <Legend /> inside the RadarChart matches existing patterns and provides a clear legend example; no issues spotted.

storybook/stories/Examples/LineChart/LineChart.stories.tsx (1)

333-377: Confirm new CustomizedDot threshold (value >= 800) is intentional

Changing the cutoff from a much higher value to value >= 800 will mark many more points with the red icon; if this is just to make the story more visually distinct, it’s fine, but please double‑check this isn’t a leftover tweak from debugging.

src/polar/RadialBar.tsx (1)

329-333: RadialBar label prop typing now matches usage and defaults

Exposing label?: ImplicitLabelListType on InternalRadialBarProps (with @defaultValue false) aligns the public type with defaultRadialBarProps.label and the existing LabelListFromLabelProp usage; this is a clean, type‑level fix with no behavior change.

test-vr/tests/CartesianAxis/CartesianAxis.multi.spec-vr.tsx (1)

1-77: Multi‑axis CartesianAxis VR test is well‑structured

Mounting four differently oriented CartesianAxis instances in a single Surface and asserting a screenshot gives solid coverage for axis layout and labeling; implementation looks straightforward and sound.

test-vr/tests/RadarChart/RadarChart.datatypes.spec-vr.tsx (1)

1-92: RadarChart datatype VR coverage is comprehensive

The four Playwright tests nicely exercise numeric vs category angle axes and the odd‑point angle distribution, each with a screenshot assertion; this should catch regressions in RadarChart’s polar coordinate handling.

Comment on lines +21 to +64
<Radar type="number" name="r" dataKey="r" fillOpacity={0} stroke="#000" />
<RechartsHookInspector />
</RadarChart>,
);
await expect(component).toHaveScreenshot();
});

test('number angle type with default domain', async ({ mount }) => {
const component = await mount(
<RadarChart
width={360}
height={360}
data={[
{ angle: 0, r: 11 },
{ angle: 90, r: 22 },
{ angle: 180, r: 33 },
{ angle: 270, r: 44 },
]}
>
<PolarGrid gridType="circle" />
<PolarRadiusAxis type="number" dataKey="r" />
<PolarAngleAxis dataKey="angle" axisLineType="circle" type="number" />
<Radar type="number" name="r" dataKey="r" fillOpacity={0} stroke="#000" />
</RadarChart>,
);
await expect(component).toHaveScreenshot();
});

test('category angle type', async ({ mount }) => {
const component = await mount(
<RadarChart
width={360}
height={360}
data={[
{ angle: 0, r: 11 },
{ angle: 90, r: 22 },
{ angle: 180, r: 33 },
{ angle: 270, r: 44 },
]}
>
<PolarGrid gridType="circle" />
<PolarRadiusAxis type="category" dataKey="r" />
<PolarAngleAxis dataKey="angle" axisLineType="circle" type="category" />
<Radar type="number" name="r" dataKey="r" fillOpacity={0} stroke="#000" />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

Verify type="number" on <Radar> is a supported and meaningful value

In the first three tests, Radar is rendered with type="number", while the numeric/category typing is already configured on PolarAngleAxis/PolarRadiusAxis. Please confirm that "number" is an accepted type value for Radar and that it affects rendering as intended; if not, consider omitting it to avoid confusion.


🌐 Web query:

What valid values does the `type` prop of the `Radar` component support in Recharts 3.5.0? Is `"number"` a documented or recommended value?

💡 Result:

Short answer: The Radar component in Recharts 3.5.0 does not expose a "type" prop. Its documented props (dataKey, points, shape, dot, legendType, label, animation props, etc.) are listed in the Radar API; there is no "type" option for Radar. [1]

Notes:

  • dataKey on Radar accepts String | Number | Function — so a Number is valid as a dataKey, but that is not a Radar "type" value. [1]
  • The "type" prop exists on other components (e.g. Line/Area/Curve) and there it accepts specific interpolation strings like "linear", "monotone", "basis", "step", etc.; "number" is not among those documented string values. [2]

References:

  • Recharts Radar API (props list, dataKey types). [1]
  • Recharts Line / Curve API (documented values for a component that does have a "type" prop). [2]

Remove unsupported type prop from <Radar> components

The type prop is not supported on the Recharts Radar component in version 3.5.0. The Radar component's documented props (dataKey, points, shape, dot, legendType, label, animation props, etc.) do not include a "type" option. Remove type="number" from all three <Radar> instances in this test file.

🤖 Prompt for AI Agents
In test-vr/tests/RadarChart/RadarChart.datatypes.spec-vr.tsx around lines 21 to
64, the Radar components include an unsupported prop type="number"; remove the
type="number" attribute from all three <Radar> instances in this block so the
Radar elements only keep supported props (name, dataKey, fillOpacity, stroke,
etc.), then save the file and re-run the visual tests.

@codecov

codecov Bot commented Nov 24, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.02%. Comparing base (04e10a8) to head (9dd8aff).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6681   +/-   ##
=======================================
  Coverage   94.02%   94.02%           
=======================================
  Files         499      499           
  Lines       42575    42575           
  Branches     4873     4873           
=======================================
  Hits        40032    40032           
  Misses       2538     2538           
  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.

@PavelVanecek
PavelVanecek merged commit 1672739 into main Nov 24, 2025
26 of 28 checks passed
@PavelVanecek
PavelVanecek deleted the less-storybooks branch November 24, 2025 05:10
@codecov

codecov Bot commented Nov 24, 2025

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

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