feat(charts): migrate registry charts to @tanstack/charts - #555
Open
mehdibha wants to merge 3 commits into
Open
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
mehdibha
force-pushed
the
claude/tanstack-charts-improvements-0495b3
branch
from
August 1, 2026 20:32
0ae2f11 to
448ae29
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The full migration of dotUI's charts from Recharts to
@tanstack/charts0.0.2(pinned) — every registry chart item rebuilt, three new chart components, per-component docs, a Charts category on the components page, and the/chartsshowcase re-run on the new engine. Plus the/internal/charts-labbench that drove the API decision.Architecture: one core, nine independent items
chart(core) — theCharthost (owns the resource-aware renderer,useId-scoped gradients, overlay slot),chartDefaults(every house decision in one auditable object), the 8-slot--chart-Npalette theme, the shared frame (axes/color/legend/focus/tooltip assembly with width-aware tick density), the structural-memoization hook that internalizes TanStack's definition-identity update contract, format resolution, and astackYtransform.shadcn add chart-barpulls core + that family only; granular@tanstack/charts/*entries keep bundles per-need):chart-area(9 variants),chart-line(9),chart-bar(9),chart-pie(10),chart-radar(14),chart-radial(6)chart-sparkline(5),chart-heatmap(4),chart-scatter(5)<AreaChart data={...} y={['desktop','mobile']} />, wide-format-first, memoization internalized), spec-fragment builders underneath (areaChartSpec(options, ctx), phantom-typed sopoint.datumis the user's row type),marks/marksBefore/polarMarksraw-grammar escape hatches.Variant parity: 71 total, zero lost. One variant reinterpreted (area
icons→labels, since per-series icons were a Recharts-config concept), several polar variants use documented workarounds proven by a dedicated spike (grid-fill as a focus-silent guide painting under rings — better than Recharts' overpaint; icon legends as HTML; center labels via the overlay so decoration never becomes a keyboard stop).What users gain over the Recharts era
ariaLabel(Recharts had no keyboard story).var(--chart-N)flows into fills, gradient stops, and the heatmap'scolor-mixsequential ramps — no injected<style>, no selector surgery on library internals.chart.mdxnow documents the core primitive.Known constraints (deliberate)
react ^19peer dep (accepted);rechartsremains a www-only dependency powering the internal lab's comparison seat — no registry item references it.animate={false}: upstream 0.0.2 tweens the SVG large-arc-flag, breaking arcs crossing 180° (worth reporting to TanStack, along with the reconciler never emptying groups that lose all children).codeOptionsbinding deferred per product decision —chartDefaultsis the ready splice target when that lands.Process
Orchestrated as multi-agent workflows: a 10-agent Opus API-decision panel → a polar-parity spike (all 30 polar variants proven reachable before committing to migrate them) → wave 1 (core + 6 cartesian/new families in parallel) → wave 2 (3 polar families + glue) → independent adversarial verification at each stage. Every builder ran typecheck/lint gates; regeneration (
build:registry,build:references) and browser verification done by the orchestrator.Final adversarial verification
A last independent Opus verifier FAILED the first cut with three real blockers, all fixed in the final commit:
@types/d3-scale/@types/d3-shapewere missing from every item's hand-declared deps (proven with an isolated consumer built from the live/r/*payloads: 25 tsc errors → 0 with types present). Every meta now declares exact-import dependencies (pinned@tanstack/*@0.0.2) plusdevDependenciesfor the types; the publisher andregistry.jsonnow passdevDependenciesthrough.RadialBarChart—polarMarks/polarMarksBeforeweren't forwarded into the identity-compared memo slots (mark objects serialize identically). Now forwarded, matching pie/radar.*Propsfrombase.tsxovertypes.ts. It now skips generic declarations without defaulted type params outsidetypes.ts(byte-stable for every non-chart reference), and the charttypes.tsfiles were corrected (requiredariaLabelon bar/scatter,y1on line, accessor-union claims removed).The verifier also confirmed at runtime: 71 showcase cards + 82 docs chart hosts render with zero empty SVGs, zero NaN geometry, zero chart console errors; every demo↔docs reference resolves both ways;
/createand the lab still work; git contains only migration files.