fix(dashboard): batch virtualized chart force-render for large-dashboard export - #42786
fix(dashboard): batch virtualized chart force-render for large-dashboard export#42786rusackas wants to merge 2 commits into
Conversation
…ard export #42561 fixes the client-side Download as Image/PDF path exporting virtualized rows as loading spinners, but forces every row into view in one instant `window` event with no batching. On a dashboard with hundreds of charts, that reintroduces the exact thundering-herd load DASHBOARD_VIRTUALIZATION exists to prevent, just moved from page-load time to export time, with no concurrency limit and no signal to the user that anything expensive is happening. This adds: - Row-level batching. Rows now carry a `data-row-id` attribute; the export path force-renders them in groups of 5 rather than all at once, waiting (with a bounded per-batch timeout) for each batch before moving to the next. A chart stuck in one batch doesn't stall every later batch, since the per-batch wait is scoped to that batch's own row elements rather than the whole container. Dashboards small enough to fit in one batch keep the original single-event behavior unchanged. - An upfront info toast ("Preparing N charts for export...") when a multi-batch export starts, so the user knows a large dashboard export is underway rather than wondering if the click did nothing. A live per-batch progress bar felt like a bigger UI commitment than this follow-up warranted; `onProgress` is exposed as an extensibility hook if that's wanted later. - Test coverage for Row.tsx's force-in-view/restore-virtualization event handling, which had none before this PR despite being the component that does the actual work. - Test coverage for the batching logic itself: grouping, per-batch timeout isolation, and the existing single-pass/flag-off paths (confirmed unchanged). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Bito Automatic Review Skipped - Branch Excluded |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The flagged issue is correct. The current implementation of superset-frontend/src/utils/downloadUtils.ts |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## upstream-fix-29719-force-render-export #42786 +/- ##
=======================================================================
Coverage 65.27% 65.28%
=======================================================================
Files 2798 2798
Lines 158048 158088 +40
Branches 36114 36120 +6
=======================================================================
+ Hits 103169 103205 +36
- Misses 52884 52888 +4
Partials 1995 1995
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Bound the combined per-batch and final whole-container waits to a single overall budget so a dashboard with many stalled batches can't burn a full per-batch timeout on each one plus another full timeout on the final check. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
SUMMARY
Follow-up to #42561, stacked on top of it (base branch is
upstream-fix-29719-force-render-export, notmaster, so this diff only shows what's new here).#42561 fixes the client-side Download as Image/PDF path exporting virtualized dashboard rows as loading spinners, by forcing every row into view before capture. The fix is correct, but it forces every row into view in a single instant
windowevent with no batching. On a dashboard with hundreds of charts, that reintroduces the exact thundering-herd loadDASHBOARD_VIRTUALIZATIONexists to prevent in the first place, just moved from page-load time to export time, with no concurrency limit and no signal to the user that anything expensive is about to happen.This adds:
data-row-idattribute; the export path force-renders them in groups of 5 rather than all at once, waiting (with a bounded 10s per-batch timeout) for each batch before moving to the next. The per-batch wait is scoped to just that batch's own row elements, not the whole container, so a chart stuck in one batch doesn't force every later batch to also burn its full timeout re-checking that same stale spinner (caught this via a failing test, not by inspection, see commit for details). Dashboards small enough to fit in one batch keep the original single-event behavior unchanged. The existing whole-container 60s check after all batches still runs as a final safety net.forceLoadAllChartsnow accepts an optionalonProgresscallback as an extensibility hook if that's wanted later.Row.tsx's event handling. fix(dashboard): force-render virtualized charts before client-side export #42561 added the force-in-view/restore-virtualization listeners toRow.tsxbut never tested them directly, only the dispatching side indownloadUtils.test.ts. This adds coverage for the actual consumer: scoped batch targeting (responds only when its own row id is in the event, or when norowIdsfilter is present at all) and observer re-attachment on restore.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — this changes the pacing/signaling of an existing export flow, not its visual output.
TESTING INSTRUCTIONS
Manually: with
DASHBOARD_VIRTUALIZATIONenabled, open a dashboard with more than 5 charts in one tab (enough to span multiple batches), and use Download → Export to Image/PDF. You should see a "Preparing N charts for export" toast, and the export should still contain every chart rendered (not loading spinners), same end result as #42561, just staggered.ADDITIONAL INFORMATION
🤖 Generated with Claude Code