Skip to content

Dedup website examples#7340

Merged
PavelVanecek merged 6 commits into
mainfrom
dedup-examples
May 18, 2026
Merged

Dedup website examples#7340
PavelVanecek merged 6 commits into
mainfrom
dedup-examples

Conversation

@PavelVanecek

@PavelVanecek PavelVanecek commented May 18, 2026

Copy link
Copy Markdown
Collaborator

Docs only. After the recent AI refactor, some examples were duplicate or close duplicate so I cleaned it up.

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced example processing to correctly handle wrapped object literals in configuration expressions.
  • Tests

    • Updated chart example test references and visual regression test timeout configuration.
    • Adjusted example assertions to reflect updated example mappings.
  • Refactor

    • Reorganized chart example documentation with updated example selections across multiple API sections.
    • Updated type annotations for example registries across codebase.
    • Removed deprecated example components.

Review Change Stack

PavelVanecek and others added 5 commits May 18, 2026 18:00
ExampleReader stopped discovering examples after the example maps switched to satisfies expressions, because the parser only handled direct object literal initializers.

Unwrap wrapped object literals before reading the example registry, add a regression test for the wrapped initializer case, and update omnidoc expectations to the current example ids on this branch.

Co-authored-by: Copilot <[email protected]>
@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • test-vr/__snapshots__/tests/www/dark-mode.spec-vr.tsx-snapshots/dark-mode-examples-list-1-webkit-linux.png is excluded by !**/*.png

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e35cf3f0-6d14-4524-94a0-4517d76d27a4

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This PR consolidates chart example components and refactors their registries to use TypeScript's satisfies constraints, while adding AST unwrapping support in the omnidoc example reader to handle satisfies-wrapped object literals. Multiple redundant example files are removed and API documentation is updated to reference consolidated alternatives.

Changes

Example component consolidation and registry refactoring

Layer / File(s) Summary
AST unwrapping infrastructure for satisfies-wrapped objects
omnidoc/readExamples.ts, omnidoc/readExamples.spec.ts, omnidoc/generateApiDoc.spec.ts
New unwrapObjectLiteralExpression helper resolves object literals wrapped in satisfies, as, or parenthesized expressions, enabling ExampleReader to extract metadata from satisfies-wrapped definitions. Tests updated to verify unwrapping and confirm example URL expectations for AreaChart examples.
Remove redundant example components and update registries to satisfies
www/src/docs/exampleComponents/AreaChart/index.ts, www/src/docs/exampleComponents/BarChart/*, www/src/docs/exampleComponents/ComposedChart/*, www/src/docs/exampleComponents/Legend/*, www/src/docs/exampleComponents/LineChart/*, www/src/docs/exampleComponents/PieChart/index.tsx, www/src/docs/exampleComponents/RadarChart/*, www/src/docs/exampleComponents/RadialBarChart/*, www/src/docs/exampleComponents/ResponsiveContainer/*, www/src/docs/exampleComponents/ScatterChart/*, www/src/docs/exampleComponents/Tooltip/index.ts, www/src/docs/exampleComponents/TreeMap/*, www/src/docs/exampleComponents/XAxis/index.ts
Removes duplicate/unused example component files (BarChartExample.tsx, ComposedChartExample.tsx, LineChartExample.tsx, RadarChartExample.tsx, RadialBarChartExample.tsx, SimpleScatterChart.tsx, TreemapExample.tsx, AreaResponsiveContainer.tsx). All remaining registries converted from explicit : Record<string, ChartExample> annotations to satisfies Record<string, ChartExample> constraints.
API examples index updates to reference consolidated examples
www/src/docs/apiExamples/BarChart/index.tsx, www/src/docs/apiExamples/ComposedChart/index.tsx, www/src/docs/apiExamples/Legend/index.tsx, www/src/docs/apiExamples/LineChart/index.tsx, www/src/docs/apiExamples/RadarChart/index.tsx, www/src/docs/apiExamples/RadialBarChart/index.tsx, www/src/docs/apiExamples/ResponsiveContainer/index.tsx, www/src/docs/apiExamples/ScatterChart/index.tsx, www/src/docs/apiExamples/Treemap/index.tsx, www/src/docs/apiExamples/useActiveTooltipCoordinate/index.ts, www/src/docs/apiExamples/useActiveTooltipDataPoints/index.ts, www/src/docs/apiExamples/useActiveTooltipLabel/index.ts, www/src/docs/apiExamples/useCartesianChartLayoutExamples.ts, www/src/docs/apiExamples/useChartLayoutExamples.ts, www/src/docs/apiExamples/useChartWidth/index.ts, www/src/docs/apiExamples/useIsTooltipActive/index.ts, www/src/docs/apiExamples/useMargin/index.ts, www/src/docs/apiExamples/useOffset/index.ts, www/src/docs/apiExamples/usePlotArea/index.ts, www/src/docs/apiExamples/usePolarChartLayoutExamples.ts, www/src/docs/apiExamples/useXAxisDomain/index.ts, www/src/docs/apiExamples/useYAxisDomain/index.ts
Updates ~20+ API example index files to reference consolidated examples across chart components and hook documentation. Examples remapped include LineChartExample → SimpleLineChart, BarChartExample → SimpleBarChart, RadarChartExample → SimpleRadarChart, and similar consolidations for composed, treemap, and scatter chart examples.
Visual regression test updates for example consolidation
test-vr/playwright-ct.config.ts, test-vr/tests/www/BarChartApiExamples.spec-vr.tsx, test-vr/tests/www/ComposedChartApiExamples.spec-vr.tsx, test-vr/tests/www/LineChartApiExamples.spec-vr.tsx, test-vr/tests/www/RadarChartApiExamples.spec-vr.tsx, test-vr/tests/www/RadialBarChartApiExamples.spec-vr.tsx, test-vr/tests/www/ScatterChartApiExamples.spec-vr.tsx, test-vr/tests/www/TreemapApiExamples.spec-vr.tsx, test-vr/tests/www/dark-mode.spec-vr.tsx
Removes VR tests for deleted example components; swaps test examples (SimpleScatterChart → ScatterChartExample). Increases Playwright test timeout from 10s to 20s and updates dark-mode examples list test to use explicit 20s timeout for screenshot assertion.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • recharts/recharts#6897: Both PRs directly touch omnidoc/readExamples.ts and associated test assertions for component/prop example URLs (AreaChart/YAxis).
  • recharts/recharts#6899: Main PR's changes to omnidoc example reading are directly tied to PR #6899's introduction of ExampleReader-based example linking in generateApiDoc.
  • recharts/recharts#6741: Both PRs modify Bar chart documentation and example registry wiring by removing/adding specific example entries.

Suggested reviewers

  • ckifer
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description is minimal but appropriately scoped: it identifies the change as docs-only and explains the motivation (cleaning up duplicates after AI refactor), though it lacks structured sections like those in the template. Consider adding structured sections from the template (Related Issue, Motivation and Context, How Has This Been Tested, Types of changes) to provide more comprehensive context for reviewers.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Dedup website examples' clearly and concisely describes the main change—removing duplicate website examples—matching the PR's primary objective.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dedup-examples

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.

@codecov

codecov Bot commented May 18, 2026

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@chromatic-com

chromatic-com Bot commented May 18, 2026

Copy link
Copy Markdown

Tip

All tests passed and all changes approved!

🟢 UI Tests: 193 tests unchanged
🟢 UI Review: 193 stories published -- no changes
Storybook icon Storybook Publish: 193 stories published

@codecov

codecov Bot commented May 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.03%. Comparing base (bb677f3) to head (dc23e15).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7340      +/-   ##
==========================================
- Coverage   89.36%   89.03%   -0.33%     
==========================================
  Files         556      548       -8     
  Lines       41143    40522     -621     
  Branches     5577     5569       -8     
==========================================
- Hits        36767    36079     -688     
- Misses       4368     4434      +66     
- Partials        8        9       +1     

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

@PavelVanecek

Copy link
Copy Markdown
Collaborator Author

/update-snapshots

@github-actions

Copy link
Copy Markdown
Contributor

✅ Visual regression snapshots have been updated and committed to this PR.

@PavelVanecek
PavelVanecek merged commit bb38637 into main May 18, 2026
4 checks passed
@PavelVanecek
PavelVanecek deleted the dedup-examples branch May 18, 2026 13:52
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.

1 participant