eschutho opened a new pull request, #43077:
URL: https://github.com/apache/superset/pull/43077

   ### 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](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to