Skip to content

fix(charts): measure immediately on mount — kill the 300ms 'No data yet' flash (cave-ukx0)#3474

Merged
BunsDev merged 1 commit into
mainfrom
fix-chart-mount-flash
Jul 19, 2026
Merged

fix(charts): measure immediately on mount — kill the 300ms 'No data yet' flash (cave-ukx0)#3474
BunsDev merged 1 commit into
mainfrom
fix-chart-mount-flash

Conversation

@BunsDev

@BunsDev BunsDev commented Jul 19, 2026

Copy link
Copy Markdown
Member

Summary

All four visx charts (BarChart, DonutChart, Heatmap, TrendChart) wrap themselves in a bare <ParentSize>@visx/responsive defaults debounceTime to 300ms, so the render-prop child gets width=0 for the first ~300ms and each chart's width === 0 guard shows the .cave-chart__empty "No data yet" state during that window.

Consequences: every chart mount flashes the empty state in the app, and any automated screenshot inside the window captures it (surfaced by the design-sync validate captures, which reliably photographed "No data yet" on chart cards).

Fix: debounceTime={0} on all four ParentSize usages — the first ResizeObserver callback applies immediately (~1 frame). Resize thrash isn't a concern at these chart sizes.

Verification

  • pnpm typecheck clean
  • Timing probe: screenshot at 600ms post-mount shows bars + category labels with no empty state — the pre-fix build reliably showed "No data yet" at the same timing

Closes bead cave-ukx0.

🤖 Generated with Claude Code

…et' flash (cave-ukx0)

All four visx charts (BarChart, DonutChart, Heatmap, TrendChart) wrap
themselves in a bare <ParentSize>, whose default debounceTime of 300ms
leaves the render-prop child at width=0 for the first ~300ms — and each
chart's width===0 guard renders the "No data yet" empty state during that
window. Every chart mount flashed empty in the app, and any automated
screenshot inside the window (design-sync validate, e2e) captured it.

Pass debounceTime={0} so the first ResizeObserver callback applies
immediately (~1 frame). Verified: at 600ms post-mount the chart shows
bars + labels with no empty state (pre-fix reliably showed "No data
yet"); tsc clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 19, 2026 17:15

Copilot AI 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.

Pull request overview

Eliminates the brief “No data yet” empty-state flash on initial mount across the app’s visx chart components by making @visx/responsive measure immediately rather than waiting for its default debounce window.

Changes:

  • Set debounceTime={0} on ParentSize for Bar, Donut, Heatmap, and Trend charts to avoid initial width === 0 rendering.
  • Keeps existing chart empty-state guards, but ensures they don’t show during the initial debounce delay.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/components/ui/charts/bar-chart.tsx Configure ParentSize with debounceTime={0} to avoid initial zero-width empty-state flash.
src/components/ui/charts/donut-chart.tsx Configure ParentSize with debounceTime={0} to avoid initial zero-width empty-state flash.
src/components/ui/charts/heatmap.tsx Configure ParentSize with debounceTime={0} to avoid initial zero-width empty-state flash.
src/components/ui/charts/trend-chart.tsx Configure ParentSize with debounceTime={0} to avoid initial zero-width empty-state flash.

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

return (
<div className="cave-chart cave-chart--bar" style={{ height }}>
<ParentSize>
<ParentSize debounceTime={0}>
return (
<div className="cave-chart cave-chart--donut" style={{ height: size }}>
<ParentSize>
<ParentSize debounceTime={0}>
return (
<div className="cave-chart cave-chart--heatmap" style={{ height }}>
<ParentSize>
<ParentSize debounceTime={0}>
return (
<div className="cave-chart cave-chart--trend" style={{ height }}>
<ParentSize>
<ParentSize debounceTime={0}>
@BunsDev BunsDev closed this Jul 19, 2026
@BunsDev
BunsDev deleted the fix-chart-mount-flash branch July 19, 2026 17:44
@BunsDev
BunsDev restored the fix-chart-mount-flash branch July 19, 2026 17:44
@BunsDev BunsDev reopened this Jul 19, 2026
@BunsDev
BunsDev merged commit 4aeb3e2 into main Jul 19, 2026
28 of 30 checks passed
@BunsDev
BunsDev deleted the fix-chart-mount-flash branch July 19, 2026 17:53
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