Skip to content

feat(v6): recharts rewrite + Next.js 16 docs + remove echarts-theme-rsuite#104

Merged
simonguo merged 33 commits intomasterfrom
copilot/refactor-project-using-recharts
Apr 27, 2026
Merged

feat(v6): recharts rewrite + Next.js 16 docs + remove echarts-theme-rsuite#104
simonguo merged 33 commits intomasterfrom
copilot/refactor-project-using-recharts

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 22, 2026

https://charts-3gc71bzf5-rsuite.vercel.app/

Rewrites @rsuite/charts v6 on top of recharts, ships a Next.js 16 docs site with live chart examples, and removes the legacy echarts-theme-rsuite package.

Key Changes

  • recharts rewrite: All chart components (BarChart, LineChart, AreaChart, PieChart, ComposedChart, ScatterChart, RadarChart, RadialBarChart, Treemap, FunnelChart) rebuilt on recharts with rsuite palette auto-coloring via injectSeriesColors
  • Next.js 16 docs site: New docs/ app with sidebar navigation, API reference, and installation guide
  • Live chart examples: All 10 chart pages use react-code-view in the proper Markdown format — each page has an index.md with code blocks wrapped in <!--start-code--> / <!--end-code--> markers, transformed at build time by @react-code-view/unplugin webpack plugin, with chart components passed as dependencies for live in-browser execution
  • Removed: echarts-theme-rsuite package and all ECharts dependencies
  • Webpack alias fix: Uses absolute srcIndexPath in resolveAlias to bypass Turbopack/webpack root-detection issues

Copilot AI and others added 4 commits April 22, 2026 09:15
- Replace ECharts/echarts-for-react with recharts v2.15.4
- New ChartContainer with responsive sizing, empty state, loading state
- Chart wrappers: BarChart, LineChart, AreaChart, ComposedChart, ScatterChart, PieChart, RadarChart, RadialBarChart, Treemap, FunnelChart
- Styled components: XAxis, YAxis, CartesianGrid, Tooltip, Legend, Brush
- Series: Bar, Line, Area, Scatter, Pie/Cell, Radar, RadialBar, Funnel
- Auto color cycling using rsuite palette
- Full TypeScript support
- Updated README with new API docs

Agent-Logs-Url: https://github.com/rsuite/charts/sessions/de933675-a809-4e04-b6f4-36e7a85872c5

Co-authored-by: simonguo <1203827+simonguo@users.noreply.github.com>
…kage

- Remove packages/echarts-theme-rsuite (no longer needed — recharts replaced ECharts)
- Promote packages/charts/* to repo root (src/, tsup.config.ts, tsconfig.json, CHANGELOG.md)
- Move packages/docs/ → docs/ at repo root
- Rewrite root package.json: single @rsuite/charts library, no workspaces
- Delete turbo.json
- Update .gitignore (dist/, docs/.next/, docs/out/)
- Fix tsconfig.json (standalone, no extends)
- Fix docs/package.json (@rsuite/charts: file:..)

Agent-Logs-Url: https://github.com/rsuite/charts/sessions/b2c56f25-d3a0-4233-be80-0ba8cedf0265

Co-authored-by: simonguo <1203827+simonguo@users.noreply.github.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 22, 2026

⚠️ No Changeset found

Latest commit: d6ab7bc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
charts Ready Ready Preview, Comment Apr 27, 2026 6:47am

Agent-Logs-Url: https://github.com/rsuite/charts/sessions/557458e1-8764-41ba-b510-1035dd4d5940

Co-authored-by: simonguo <1203827+simonguo@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

Deployment failed with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/rsuite?upgradeToPro=build-rate-limit

… simplify CI to React 18

- Add jest@^27.5.1 and jest-environment-jsdom@^27.5.1 to devDependencies
  (jest was in scripts but not declared; jest-environment-jsdom is required
  separately since Jest 28, but we pin to 27 to match @swc-node/jest@1.5.2)
- Update @testing-library/react ^11 → ^13.4.0 (React 18 compatible)
- Update @types/jest ^26 → ^27.4.0 (matches jest@27)
- Simplify jest.config.js: remove dead react-17/react-18 alias blocks
- Update CI workflow: drop React 16/17 matrix (v6 targets React 18)
  and remove --force flag from npm ci
- Regenerate package-lock.json to be in sync with package.json

Agent-Logs-Url: https://github.com/rsuite/charts/sessions/557458e1-8764-41ba-b510-1035dd4d5940

Co-authored-by: simonguo <1203827+simonguo@users.noreply.github.com>
…cide-react SVGs

- Add webpack alias in docs/next.config.ts pointing @rsuite/charts → ../src/index.ts
  so the docs build works without needing a pre-built dist/
- Add tsconfig path alias in docs/tsconfig.json for TypeScript IntelliSense
- Add lucide-react@^1.8.0 to docs/package.json
- Replace emoji icons with lucide-react SVG icons in:
  - docs/app/page.tsx (hero icon + chart grid cards)
  - docs/app/components/Sidebar.tsx (sidebar logo)

Agent-Logs-Url: https://github.com/rsuite/charts/sessions/2ca44d22-d78c-4c5d-ba16-07d167bca814

Co-authored-by: simonguo <1203827+simonguo@users.noreply.github.com>
…bpack alias

Next.js 16 defaults to Turbopack for `next dev`, which rejects a bare
`webpack` config. Add `turbopack.resolveAlias` so both dev (Turbopack)
and build (webpack) resolve @rsuite/charts → ../src/index.ts.

Agent-Logs-Url: https://github.com/rsuite/charts/sessions/cedc2099-4108-4a38-a257-1fd4688a6847

Co-authored-by: simonguo <1203827+simonguo@users.noreply.github.com>
…arts

Turbopack does not accept absolute filesystem paths in resolveAlias —
it interprets them as server-relative URL paths, causing:
  "server relative imports are not implemented yet"

Use '../src/index.ts' (relative to the docs/ project root) for Turbopack,
while keeping the absolute path for the webpack fallback used by next build.

Agent-Logs-Url: https://github.com/rsuite/charts/sessions/0afde7fd-e3ec-4278-ad82-2a9fbfb901c2

Co-authored-by: simonguo <1203827+simonguo@users.noreply.github.com>
…esolution

Turbopack auto-detects its root by searching for lockfiles upward and was
picking /Users/apple/package-lock.json (home dir) as the root instead of
the docs/ directory. Relative paths in turbopack.resolveAlias are resolved
against this root, so '../src/index.ts' was resolving to /src/index.ts
(non-existent) rather than charts/src/index.ts.

Setting turbopack.root = __dirname (docs/) corrects the root so that:
  '../src/index.ts' → docs/../src/index.ts → charts/src/index.ts  ✓

This fixes the "Module not found: Can't resolve @rsuite/charts" error in
Turbopack dev mode, which in turn fixes the empty chart boxes shown in the
docs site (charts were blank because the JS bundle failed to load the module).

Agent-Logs-Url: https://github.com/rsuite/charts/sessions/b80e051f-1fa7-4b17-bd05-8fd4b693443c

Co-authored-by: simonguo <1203827+simonguo@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.71%. Comparing base (fd0ae35) to head (7319854).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #104      +/-   ##
==========================================
+ Coverage   83.20%   92.71%   +9.50%     
==========================================
  Files          21       30       +9     
  Lines         530      974     +444     
  Branches      135       99      -36     
==========================================
+ Hits          441      903     +462     
+ Misses         74       70       -4     
+ Partials       15        1      -14     
Flag Coverage Δ
React-16 ?
React-17 ?
React-18 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 67 out of 227 changed files in this pull request and generated 11 comments.

Files not reviewed (1)
  • docs/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment thread jest-results-processor.js Outdated
Comment thread src/charts/Treemap.tsx
Comment thread src/charts/ScatterChart.tsx
Comment thread eslint.config.cjs
Comment thread src/ChartContainer.tsx
Comment thread src/ChartContainer.tsx
Comment thread src/charts/Treemap.tsx
Comment thread docs/next.config.ts Outdated
Comment thread docs/app/installation/page.tsx Outdated
…emap tooltip

- utils.ts: skip auto-Cell injection when any data item already has an
  explicit `fill` property, preventing palette colors from overriding
  user-supplied per-datum fills
- Treemap.tsx: replace hardcoded tooltip colors with colors.tooltipBackground,
  colors.tooltipBorder, colors.tooltipLabel, and colors.tooltipText so that
  dark mode renders correctly
- utils.test.ts: add 5 tests covering Pie auto-Cell scenarios (inject, skip all
  fills, skip partial fills, skip when children present, empty palette guard)
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 66 out of 226 changed files in this pull request and generated 6 comments.

Files not reviewed (1)
  • docs/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/app/installation/page.tsx Outdated
Comment thread .npmrc
Comment thread README.md
Comment thread docs/next.config.ts
Comment thread package.json
Comment thread package.json
…hart rendering

@rsuite/charts is symlinked into docs/node_modules, but its dist files
resolve 'react' from the root-level node_modules/react (a different module
instance than docs/node_modules/react). This dual-React-instance issue
silently breaks hook calls inside chart components (BarChart, etc.) when
rendered through the CodeDemo live-preview, causing blank preview boxes
with no visible error.

Add turbopack resolveAlias to pin react / react-dom / jsx-runtime to the
single docs/node_modules/react installation.
turbopack resolveAlias does not accept absolute paths (path.resolve) —
it prepends './' turning them into invalid relative paths like
'./Users/apple/...'. Use paths relative to turbopack.root ('../') instead.

Also alias '@rsuite/charts' to './src/index.ts' so turbopack compiles
the TypeScript source directly (no stale-dist risk) and all React imports
resolve to the single docs/node_modules/react instance.
The sucrase + new Function approach silently failed to render chart
components due to a dual-React-instance issue (BarChart's internal hooks
ran against a different React instance than the one driving the preview).

react-live passes React and all scope dependencies explicitly into the
execution context, avoiding the instance mismatch. noInline=true preserves
the existing render(...) call style used in all code samples.

Also restore next.config.ts to the simple form (turbopack.root only),
removing the broken resolveAlias absolute paths that were causing
'server relative imports' errors.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 66 out of 226 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • docs/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +50 to +54
const handleCopy = () => {
navigator.clipboard.writeText(children.trim());
setCopied(true);
setTimeout(() => setCopied(false), 2000);
};
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

navigator.clipboard.writeText(...) can throw or be unavailable (non-secure contexts, permission denied). Right now this will produce an unhandled rejection/exception in the docs UI. Wrap this in try/catch (and/or await + .catch) and consider a fallback copy mechanism or a user-visible error state.

Copilot uses AI. Check for mistakes.
Comment thread docs/package.json
Comment on lines +10 to +18
"dependencies": {
"@rsuite/charts": "file:..",
"lucide-react": "^1.8.0",
"next": "^16.2.4",
"prism-react-renderer": "^2.4.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"recharts": "^2.15.4",
"sucrase": "^3.35.1"
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

PR description says the docs use react-code-view / @react-code-view/unplugin + Markdown markers, but the docs app currently uses a custom CodeDemo implementation (sucrase + new Function) and has no react-code-view dependency. Please either update the PR description to match the implementation, or add the missing dependency/plugin and migrate pages accordingly.

Copilot uses AI. Check for mistakes.
@simonguo simonguo merged commit 996eeba into master Apr 27, 2026
7 checks passed
@simonguo simonguo deleted the copilot/refactor-project-using-recharts branch April 27, 2026 07:54
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.

3 participants