Skip to content

Add hook inspector to all website examples#6804

Merged
ckifer merged 8 commits into
mainfrom
devtools
Dec 19, 2025
Merged

Add hook inspector to all website examples#6804
ckifer merged 8 commits into
mainfrom
devtools

Conversation

@PavelVanecek

@PavelVanecek PavelVanecek commented Dec 19, 2025

Copy link
Copy Markdown
Collaborator

Description

I find this useful for debugging so I figured why not have it on the website too. Optional, defaults to source code as it was before.

image

Summary by CodeRabbit

  • New Features

    • Added developer tools integration for interactive chart inspection and debugging.
    • Implemented mode-based UI switching in the code editor for seamless navigation between source code and developer tools views.
    • Enabled devtools across all chart examples and documentation for enhanced development experience.
  • Chores

    • Updated development dependency to latest version.

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

@coderabbitai

coderabbitai Bot commented Dec 19, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

A large-scale integration of RechartsDevtools across the example codebase. The @recharts/devtools dependency is bumped, CodeEditorWithPreview is refactored to use EditorMode and RechartsDevtoolsContext, and RechartsDevtools components are added to 70+ guide and example chart files. StackBlitz code generation is updated to include devtools context.

Changes

Cohort / File(s) Summary
Dependency Update
package.json
Bumped @recharts/devtools from ^0.0.3 to ^0.0.5 in devDependencies.
Editor Component Refactor
www/src/components/CodeEditorWithPreview.tsx
Introduced RechartsDevtoolsContext wrapper, replaced extraToolbarItems prop model with new EditorMode type and mode-based UI (source/devtools modes), added activeMode, onModeChange, tools, and toolbarItems props; toolbar conditionally renders Run or Edit button and StackBlitz link.
Shared Utilities
www/src/components/Shared/StackBlitzLink.tsx
Refactored indexTsxCode to accept title parameter; generated StackBlitz template now imports RechartsDevtoolsContext and RechartsDevtoolsPortal, includes root container validation, wraps app with AppWithDevtools component.
Guide View Components – ChartSizing
www/src/components/GuideView/ChartSizing/ChartWithoutSize.tsx, ResponsiveChart.tsx, ResponsiveContainerResponsiveChart.tsx, SizeInPercentChart.tsx, SizeInStyleChart.tsx, StaticDimensionChart.tsx
Added RechartsDevtools import and rendered <RechartsDevtools /> inside LineChart.
Guide View Components – GettingStarted
www/src/components/GuideView/GettingStarted/Step1.tsx through Step5.tsx
Added RechartsDevtools import and rendered <RechartsDevtools /> inside LineChart for each step.
Guide View Components – Customize
www/src/components/GuideView/Customize/CustomizeBarShape.tsx, CustomizeLabels.tsx, CustomizeLegendAndTooltipStyle.tsx, CustomizeSizeAndStroke.tsx, CustomizeTooltipContent.tsx
Added RechartsDevtools import and rendered <RechartsDevtools /> inside BarChart.
Guide View Components – DomainAndTicks
www/src/components/GuideView/DomainAndTicks/MassBarChart.tsx, MassBarChartCategoricalY.tsx, MassBarChartCustomTicks.tsx, MassBarChartCustomYDomain.tsx, MassBarChartLogScale.tsx
Added RechartsDevtools import and rendered <RechartsDevtools /> inside BarChart.
Guide View Components – ActiveIndex & ZIndex
www/src/components/GuideView/ActiveIndex/BarChartClickable.tsx, PieChartDefaultIndex.tsx, www/src/components/GuideView/ZIndex/PrahaMetro.tsx
Added RechartsDevtools import and rendered <RechartsDevtools /> inside chart components.
API Examples – Area/Bar/Composed/Other Charts
www/src/docs/apiExamples/AreaChart/*, BarChart/*, Cell/*, ComposedChart/*, ErrorBar/*, Funnel/*, FunnelChart/*, Label/*, LabelList/*, Legend/*, LineChart/*, PieChart/*, Radar/RadarChartExample.tsx, RadialBarChart/*, Reference*/*, ResponsiveContainer/*, SankeyChart/*, ScatterChart/*, Treemap/*, ZIndexLayer/*
Added RechartsDevtools import and rendered <RechartsDevtools /> inside respective chart components across all API example files.
Example Components – AreaChart
www/src/docs/exampleComponents/AreaChart/AreaChartConnectNulls.tsx, AreaChartFillByValue.tsx, AreaChartNavExample.tsx, CardinalAreaChart.tsx, PercentAreaChart.tsx, SimpleAreaChart.tsx, StackedAreaChart.tsx, SynchronizedAreaChart.tsx, TinyAreaChart.tsx
Added RechartsDevtools import and rendered <RechartsDevtools /> inside AreaChart instances.
Example Components – BarChart
www/src/docs/exampleComponents/BarChart/BarChartHasBackground.tsx, BarChartNavExample.tsx, BarChartStackedBySign.tsx, BarChartWithCustomizedEvent.tsx, BarChartWithMinHeight.tsx, BarChartWithMultiXAxis.tsx, BiaxialBarChart.tsx, BrushBarChart.tsx, CustomShapeBarChart.tsx, MixBarChart.tsx, PopulationPyramidExample.tsx, PositiveAndNegativeBarChart.tsx, RangedStackedBarChart.tsx, SimpleBarChart.tsx, StackedBarChart.tsx, TimelineExample.tsx, TinyBarChart.tsx
Added RechartsDevtools import and rendered <RechartsDevtools /> inside BarChart.
Example Components – ComposedChart
www/src/docs/exampleComponents/ComposedChart/BandedChart.tsx, ComposedChartNavExample.tsx, ComposedChartWithAxisLabels.tsx, LineBarAreaComposedChart.tsx, SameDataComposedChart.tsx, ScatterAndLineOfBestFit.tsx, TargetPriceChart.tsx, VerticalComposedChart.tsx
Added RechartsDevtools import and rendered <RechartsDevtools /> inside ComposedChart.
Example Components – Legend & LineChart
www/src/docs/exampleComponents/Legend/LegendEffectOpacity.tsx, www/src/docs/exampleComponents/LineChart/BiaxialLineChart.tsx, CompareTwoLines.tsx, CustomizedDotLineChart.tsx, CustomizedLabelLineChart.tsx, DashedLineChart.tsx, HighlightAndZoomLineChart.tsx, LineChartAxisInterval.tsx, LineChartConnectNulls.tsx, LineChartHasMultiSeries.tsx, LineChartNavExample.tsx, LineChartNegativeValuesWithReferenceLines.tsx, LineChartWithReferenceLines.tsx, LineChartWithXAxisPadding.tsx, SimpleLineChart.tsx, SynchronizedLineChart.tsx
Added RechartsDevtools import and rendered <RechartsDevtools /> inside LineChart instances.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Areas requiring extra attention:

  • CodeEditorWithPreview.tsx — Mode-based UI logic, state management for activeMode, context wrapping, and toolbar prop changes require careful verification
  • StackBlitzLink.tsx — Template generation logic, devtools context/portal setup, and AppWithDevtools wrapper functionality should be validated for correctness
  • Consistency across 70+ files — Verify RechartsDevtools component placement (typically as final child in chart) is correct and doesn't conflict with layout in any file
  • Import path validation — Ensure @recharts/devtools import path is consistent and resolvable across all example files

Possibly related PRs

Suggested labels

enhancement, feature request

Suggested reviewers

  • ckifer

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 53.85% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The PR description is minimal and lacks key structural details required by the repository template. Expand the description to include: Related Issue link, detailed Motivation and Context explaining why this feature is needed, How Has This Been Tested section with testing details, and completion of the Types of changes and Checklist sections.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add hook inspector to all website examples' clearly and accurately summarizes the main change in the pull request.
✨ 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 devtools

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

@@ -1,4 +1,5 @@
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, DotItemDotProps } from 'recharts';
import { RechartsDevtools } from '@recharts/devtools';

@coderabbitai coderabbitai Bot Dec 19, 2025

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 | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the versions of recharts and @recharts/devtools in package.json
cat www/package.json | jq '{recharts: .dependencies.recharts, devtools: .dependencies["@recharts/devtools"]}'

Repository: recharts/recharts

Length of output: 107


Add @recharts/devtools to package.json dependencies.

The import from @recharts/devtools on this line will fail because the package is not listed in www/package.json dependencies. Add @recharts/devtools to the dependencies with an appropriate version before this import can be used.

🤖 Prompt for AI Agents
In www/src/docs/exampleComponents/LineChart/CustomizedDotLineChart.tsx around
line 2, the file imports RechartsDevtools from '@recharts/devtools' but that
package is not declared in www/package.json; add "@recharts/devtools" to the
dependencies in www/package.json (choose a version compatible with the installed
recharts version, e.g. matching the same major), then run the project package
manager (npm/yarn/pnpm) to install/update node_modules so the import resolves
successfully.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

These are a dependency in the root package.json, part of the same monorepo/workspace

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.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

@codecov

codecov Bot commented Dec 19, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.64894% with 69 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.75%. Comparing base (b4948a8) to head (b87ed4f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
www/src/utils/CodeMirrorEditor.tsx 81.66% 11 Missing ⚠️
www/src/components/CodeEditorWithPreview.tsx 85.18% 4 Missing ⚠️
www/src/utils/CopyButton.tsx 20.00% 4 Missing ⚠️
www/src/components/Shared/StackBlitzLink.tsx 25.00% 3 Missing ⚠️
...ww/src/docs/apiExamples/Treemap/TreemapExample.tsx 33.33% 2 Missing ⚠️
...onents/GuideView/ActiveIndex/BarChartClickable.tsx 50.00% 1 Missing ⚠️
...nts/GuideView/ActiveIndex/PieChartDefaultIndex.tsx 50.00% 1 Missing ⚠️
...ponents/GuideView/ChartSizing/ChartWithoutSize.tsx 50.00% 1 Missing ⚠️
...mponents/GuideView/ChartSizing/ResponsiveChart.tsx 50.00% 1 Missing ⚠️
...ChartSizing/ResponsiveContainerResponsiveChart.tsx 50.00% 1 Missing ⚠️
... and 40 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6804      +/-   ##
==========================================
- Coverage   93.83%   93.75%   -0.09%     
==========================================
  Files         518      518              
  Lines       44781    45122     +341     
  Branches     5037     5046       +9     
==========================================
+ Hits        42021    42302     +281     
- Misses       2753     2813      +60     
  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
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

And of course I forgot the chart right on the index page.

@codecov

codecov Bot commented Dec 19, 2025

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@ckifer
ckifer merged commit 1366901 into main Dec 19, 2025
74 of 77 checks passed
@ckifer
ckifer deleted the devtools branch December 19, 2025 06:26
@coderabbitai coderabbitai Bot mentioned this pull request Dec 19, 2025
8 tasks
@coderabbitai coderabbitai Bot mentioned this pull request Mar 28, 2026
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