Skip to content

fix(reports): wait for ECharts paint before capturing report screenshots - #43077

Draft
eschutho wants to merge 3 commits into
masterfrom
fix-reports-echarts-paint-readiness
Draft

fix(reports): wait for ECharts paint before capturing report screenshots#43077
eschutho wants to merge 3 commits into
masterfrom
fix-reports-echarts-paint-readiness

Conversation

@eschutho

Copy link
Copy Markdown
Member

Summary

Scheduled dashboard reports (and the report screenshot path generally) can deliver an image with blank chart regions. The non-tiled readiness gate added in #42624 / #42253 treats a chart holder as rendered as soon as .slice_container is present with no .loading. But .slice_container mounts when the chart's data arrives — before the ECharts canvas is actually drawn — so a full_page capture can fire on an empty canvas.

There is no existing "render finished" signal for screenshots (see the comment in Echart.tsx that disables animation for exactly this reason). chartStatus === 'rendered' / onRenderSuccess both fire on loadable module-load, before paint. The only signal that guarantees the canvas is painted is ECharts' own finished event.

Fix

  • Frontend (plugin-chart-echarts/.../Echart.tsx): tag the canvas host with the runtime class echarts-host, and add echarts-render-finished only in the ECharts finished event (cleared before each setOption). Classes are used because production strips data-test.
  • Readiness gate (screenshot_utils.py): a holder that still contains an unpainted .echarts-host is non-terminal (new mounted_unpainted state) — the gate waits for it and fails loud on timeout rather than capturing blank. Applied to both the dashboard holder gate and the single chart-container gate.

Only ECharts hosts are gated. DOM/SVG vizzes paint synchronously on React commit, and non-ECharts canvas vizzes (deck.gl, mapbox, OpenLayers) have no .echarts-host, so they are unaffected (and the gate never waits on them — no risk of hanging those reports). Giving those canvas vizzes their own completion markers is a natural follow-up.

This is complementary to #42901 (which grows the viewport so off-screen holders mount): that ensures holders are present; this ensures they are painted before capture.

Testing

  • Added a unit test asserting the readiness predicates and diagnostics key on the paint marker.
  • The readiness predicate JS was verified in a headless browser against a synthetic DOM: an in-viewport unpainted ECharts host makes the report gate return false; a painted host passes; DOM/non-ECharts holders are unchanged; off-screen holders are still skipped.
  • The finished-means-painted premise was verified directly against echarts 5.6 (the finished event fires only once the canvas is fully drawn, with animation on or off).

Additional info

  • Draft: pending a jest test for the marker and an end-to-end report capture check in CI.

🤖 Generated with Claude Code

Scheduled dashboard reports could deliver a screenshot with blank chart
regions. The readiness gate treated a holder as "rendered" once
.slice_container was present, but that mounts when data arrives -- before the
ECharts canvas is drawn -- so the capture could fire on an empty canvas.

Tag the ECharts host .echarts-host and add .echarts-render-finished only in
the ECharts finished event, the single signal that the canvas is fully
painted (chartStatus/onRenderSuccess both fire pre-paint). The readiness gate
now treats a holder with an unpainted host as non-terminal (mounted_unpainted)
and waits for it, failing loud on timeout instead of capturing blank. Applies
to the dashboard gate and the single chart-container gate.

Only ECharts hosts are gated: DOM/SVG vizzes paint on commit and non-ECharts
canvas vizzes have no .echarts-host, so they are unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Verifies the host carries echarts-host and that echarts-render-finished is
set only when the ECharts finished event fires (not on mount/setOption).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Aug 11, 2026
@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.77%. Comparing base (af258c2) to head (ca817f1).
⚠️ Report is 50 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #43077      +/-   ##
==========================================
+ Coverage   66.00%   66.77%   +0.77%     
==========================================
  Files        2866     2862       -4     
  Lines      162263   161643     -620     
  Branches    37346    37283      -63     
==========================================
+ Hits       107097   107933     +836     
+ Misses      53100    51666    -1434     
+ Partials     2066     2044      -22     
Flag Coverage Δ
hive 38.44% <100.00%> (+0.26%) ⬆️
javascript 73.64% <100.00%> (+<0.01%) ⬆️
mysql 58.10% <100.00%> (+0.34%) ⬆️
postgres 58.14% <100.00%> (+0.32%) ⬆️
presto 40.42% <100.00%> (+0.29%) ⬆️
python 59.54% <100.00%> (+1.51%) ⬆️
sqlite 57.75% <100.00%> (+0.32%) ⬆️
unit 100.00% <ø> (?)

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

☔ View full report in Codecov by Harness.
📢 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.

Import order, prettier formatting, and jest-dom toHaveClass. No logic change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@netlify

netlify Bot commented Aug 11, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit ca817f1
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a7bb4e6515f6d0008285e11
😎 Deploy Preview https://deploy-preview-43077--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants