Uh oh!
There was an error while loading. Please reload this page.
fix(plugin-charts): draw dashboard chart bars on first paint via isAnimationActive=false (#2756) - #2759
Merged
Merged
Conversation
…imationActive=false (#2756) #2727's settle re-mount tried to *heal* a frozen Recharts entrance animation by re-mounting the ResponsiveContainer once the grid settled. Live (react-grid-layout) that bet doesn't hold: the re-mount can land back in mount-time measurement churn, so the rAF tween — which starts at height 0 — stays stuck there and bars never draw, though axes/labels and the data are present. Reproduced in a real browser on the showcase Chart Gallery dashboard: pre-fix, bars sit at ~0 for 8s+; identical to the reported magic-flow symptom. Fix: dashboard chart widgets render with isAnimationActive={false}, so there is no entrance-animation tween to freeze — bars render at final geometry on the first committed frame, deterministically. With the animation off there is nothing to heal, so ChartContainer skips its settle re-mount (new disableSettleRemount prop), avoiding a needless 1-frame ResponsiveContainer reflow on first paint. Every dashboard chart schema carries the flag (DatasetWidget + DashboardRenderer + DashboardGridLayout, both chart and object-chart); AdvancedChartImpl now honors isAnimationActive uniformly across bar/line/area/pie/funnel/treemap/radar/scatter (funnel/treemap/radar/ scatter previously hard-coded animation on). Standalone chart views keep their entrance animation. Verified end-to-end in a real browser (worktree console → live backend): before = frozen empty bars after 8s, after = bars drawn on first paint, zero console errors, deterministic across fresh navigations and a fresh tab. plugin-charts + plugin-dashboard: 156 tests pass; both type-check. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Problem
Dashboard bar/area/line/horizontal-bar widgets render axes + category labels but not a single bar on first mount; the bars only draw after an unrelated re-render (theme toggle / resize / re-nav). The data is fine — a pure frontend mount-time race. Fixes#2756 (the follow-up to #2727, whose settle re-mount was ineffective live).
Root cause
The Recharts entrance animation is a
requestAnimationFrametween that starts at height 0 (JavascriptAnimate:useState(isActive ? 0 : 1)). Inside areact-grid-layoutdashboard,ResponsiveContainer's mount-time 0→positive measurement churn interrupts that tween before it advances, so bars stay frozen at 0.#2727 tried to heal this by re-mounting
ResponsiveContaineronce the outer box settles. But the freeze lives insideResponsiveContainer's own measurement, and the healing re-mount can land right back in the churn — so it never reliably replays. Keying/remounting the outer div can't fix an inner-measurement race.Fix
Dashboard chart widgets render with
isAnimationActive={false}— there is no entrance tween to freeze, so bars render at their final geometry on the first committed frame, deterministically, regardless of grid/measurement timing. This reuses the same deterministic, export-safe render path reports already use.DatasetWidget(chart),DashboardRenderer(chart+object-chart),DashboardGridLayout(chart+object-chart).AdvancedChartImplnow honorsisAnimationActiveuniformly —funnel/treemap/radar/scatterpreviously hard-coded animation on; they now respect the flag like bar/line/area/pie.ChartContainerskips its settle re-mount via a newdisableSettleRemountprop — avoids a needless 1-frameResponsiveContainerreflow on first paint.Verification — real browser, real code path (worktree console → live backend)
This is the step #2727 couldn't do. Ran the showcase Chart Gallery dashboard (
react-grid-layout, theDatasetWidgetpath) against a live backend, with the console serving the worktree's edited plugin source:main)A/B done by
git stash-toggling the fix and confirming (over HTTP) which source vite served each time.Tests
plugin-charts+plugin-dashboard: 156 pass (path-scopedvitest run); both packagestype-checkclean.ChartContainerImpl.settleRemountcase:disableSettleRemountfully suppresses the re-mount even at a positive stable box.DatasetWidget.animation.test.tsx: the chart schema handed to the renderer carriesisAnimationActive: false.🤖 Generated with Claude Code