fix(plugin-charts,components): dashboard charts blank on first paint (ResponsiveContainer width(-1))#1634
Merged
Merged
Conversation
…siveContainer measures real width
Recharts' <ResponsiveContainer> was a child of a `flex ... justify-center`
container, so on the main axis it collapsed to content width (0) on first
paint inside react-grid-layout. Recharts then measured width(-1)/height(-1)
and skipped drawing, leaving dashboard charts (funnel, donut, area, …) blank
on initial load until a later resize fired its ResizeObserver.
Switch the chart wrapper to a definite-width block (drop `flex`/`justify-center`,
use `w-full` / `aspect-video w-full`) in both the dashboard chart container
(ChartContainerImpl) and the shadcn base (components/ui/chart) so the chart
always fills its box and renders on first paint. The empty-state ("No rows")
is a separate component and is unaffected.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
os-zhuang
added a commit
that referenced
this pull request
Jun 11, 2026
…ix (#1634) (#1635) #1634 fixed dashboard charts rendering blank on first paint but merged without a changeset. Add a patch changeset so the fix is credited in the next release changelog (plugin-charts/components are in the fixed version group, so the fix already ships either way). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
Dashboard charts (funnel, donut, area, …) render blank on initial load and only appear after a window resize / layout change. The console is flooded with:
Root cause
Every dashboard chart renders through
AdvancedChartImpl→ChartContainerinpackages/plugin-charts/src/ChartContainerImpl.tsx. That container wasflex w-full h-[350px] justify-center, and Recharts'<ResponsiveContainer width="100%" height="100%">was its flex child. In ajustify-centerflex row the child is sized to its content on the main axis, so on first paint insidereact-grid-layout(before the grid applies column widths) it collapsed to width 0 → Recharts measuredwidth(-1)and skipped drawing. It only recovered when a later resize firedResponsiveContainer'sResizeObserver. The existingminHeight: 280guard fixed height but not the width collapse.The shadcn base
packages/components/src/ui/chart.tsx(flex aspect-video justify-center, dimensionless<ResponsiveContainer>) has the same latent issue.Fix
Give
ResponsiveContainera definite-width block parent instead of a width-collapsing centered flexbox:plugin-charts/ChartContainerImpl.tsx:flex … justify-center→block w-full h-[350px](min-size guard kept).components/ui/chart.tsx:flex aspect-video justify-center→block aspect-video w-full.The
"No rows"empty state is a separate component (plugin-dashboard/DatasetWidget.tsx) and is unaffected; flex-centering was vestigial for the chart path (the only child isResponsiveContainer, which fills 100%).Verification
@object-ui/plugin-chartstype-check✅ andtest✅ (11/11).plugin-list/ListView.test.tsx(viewType normalization, fix(plugin-list): normalize viewType 'list'/missing/unknown to the grid renderer #1632 /fix/listview-default-grid) — untouched by this change.recharts-trapezoidcount = 0; after any resize the same charts paint correctly (data was always present). This change makes them paint on first load.🤖 Generated with Claude Code