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

   ### SUMMARY
   
   Follow-up to #42561, stacked on top of it (base branch is 
`upstream-fix-29719-force-render-export`, not `master`, 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 `window` event with no batching. On a dashboard with hundreds of 
charts, that reintroduces the exact thundering-herd load 
`DASHBOARD_VIRTUALIZATION` exists 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:
   
   - **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 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.
   - **An upfront info toast** ("Preparing N charts for export. This may take a 
moment.") when a multi-batch export starts, so the user gets a signal that a 
large 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; `forceLoadAllCharts` now accepts an optional `onProgress` callback 
as an extensibility hook if that's wanted later.
   - **Test coverage for `Row.tsx`'s event handling.** #42561 added the 
force-in-view/restore-virtualization listeners to `Row.tsx` but never tested 
them directly, only the dispatching side in `downloadUtils.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 no `rowIds` filter is present at all) 
and observer re-attachment on restore.
   - **Test coverage for the batching logic**: grouping into batches of 5, 
progress callback sequencing, per-batch timeout isolation (the bug mentioned 
above), and confirming the existing single-pass/flag-off paths from #42561 are 
unchanged.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — this changes the pacing/signaling of an existing export flow, not its 
visual output.
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   npx jest src/utils/downloadUtils.test.ts 
src/dashboard/components/gridComponents/Row/Row.test.tsx
   ```
   
   Manually: with `DASHBOARD_VIRTUALIZATION` enabled, 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
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 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