Skip to content

Upon download as PDF, charts on a long dashboard render as loading image #29719

Closed

Description

@sfirke

Bug description

My user has a long dashboard - 41 charts on the tab she is downloading to PDF. I wait for the charts to all load. Then when I click Download -> PDF, the first 7 charts (Firefox) or 9 charts (Chrome) are rendered, followed by the remaining ~32 charts that have the loading symbol.

If I use my browser (both Chrome and Firefox) print function, the first 9 charts are rendered, followed by 32 with loading symbols. Possible duplicate of #27008 which was closed for lack of details.

How to reproduce the bug

Create a dashboard with very many charts in one tab, each with a moderate load time (say 0.5+ seconds). Let all the charts load. Export to PDF or use the browser print-to-PDF function.

Screenshots/recordings

image

Superset version

4.0.2

Python version

Not applicable

Node version

Not applicable

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Activity

  1. sfirke commented on Jul 26, 2024

    @sfirke
    MemberAuthor

    A naive question: if all of the charts have loaded in my browser, why would any of them be the loading icon when I print to PDF?

  2. rusackas commented on Jul 26, 2024

    @rusackas
    Member

    I think this is a duplicate of #29719
    I also think @kgabryje might have looked at this while I was away on vacation... but I haven't caught up on the result yet.

  3. sfirke commented on Jul 26, 2024

    @sfirke
    MemberAuthor

    @rusackas you linked back to this same issue, did you mean to link to a different one? EDIT: I bet you meant #28713, yes that looks similar

  4. Xyrai commented on Aug 1, 2024

    @Xyrai

    Same issue here, I want my users to be able to print the graphs on the page that are rendered outside of their viewport.

    I am using the @superset-ui/embedded-sdk NPM package, it would be really nice to have an update within there or an option to toggle this kind of feature. Also, is there a way to check when the rendering of all graphs have finished?

  5. nandwalritik commented on Aug 7, 2024

    @nandwalritik

    @sfirke Same Issue occurs when downloading as image, any fix available for above bug?

  6. kgabryje commented on Aug 7, 2024

    @kgabryje
    Member

    I think this might be fixed by #29272 (CC @geido)

  7. Xyrai commented on Aug 16, 2024

    @Xyrai

    Still seems to be broken on my side sadly while using superset-ui/embedded-sdk. I tried a workaround where you have to adjust the iframeSandboxExtras options and include allow-modals to it. This way you can focus on the iframe via the DOM tree and fire a window.print() event to only have the dashboard rendering on the browser PDF.

    However, this still seems to showcase only the graphs that are within the viewport of a user.
    In case the version matters, I tried this on the latest one "@superset-ui/embedded-sdk": "^0.1.0-alpha.12"

  8. 123srikan commented on Aug 20, 2024

    @123srikan

    any update on this issue.

  9. MNITD commented on Sep 9, 2024

    @MNITD

    From what my team investigated it might be due to the virtualization feature - i.e. the superset UI off-loads charts that are away from the viewport

    So I am not sure there is such thing as "all-charts-were-loaded" event

    In our case, we found a workaround:

    • we disabled the virtulaization feature by changing the superset config (docker/pythonpath_dev/superset_config_docker.py)
    • inside the config we updated the FEATURE_FLAGS variable:
    FEATURE_FLAGS = {
        "DASHBOARD_VIRTUALIZATION": False,
    }

    Now the dashboard loads charts once without off-loading them during the scroll
    In result, we don't have any loading spinners on the downloaded PDF

    Perhaps it will help someone 👀

  10. geido commented on Sep 9, 2024

    @geido
    Member

    Thanks, looking into it

  11. zachoooo commented on Feb 7, 2025

    @zachoooo

    That's really interesting. It sounds like maybe virtualization just needs to be disabled when downloading.

  12. rusackas commented on May 28, 2025

    @rusackas
    Member

    Assuming this one is still an issue? Just asking since it's been quiet here since February :D Also curious if it's an issue at all when PLAYWRIGHT_REPORTS_AND_THUMBNAILS is enabled.

  13. rusackas commented on Jun 10, 2025

    @rusackas
    Member

    These all seem like they might effectively be the same issue:

    #29394
    #31158
    #29719
    #28713
    #27532

    Can anyone here test this with DASHBOARD_VIRTUALIZATION set to false? I have a suspicion that may fix it. If so, we can probably just disable viewport virtualization when the headless browser is building the screencap.

  14. tsator commented on Oct 7, 2025

    @tsator

    Hi! @rusackas, i was having the same problem: some charts were showing up with the loading spinner when exporting the PDF. The suggested solution

    FEATURE_FLAGS = {
        "DASHBOARD_VIRTUALIZATION": False,
    }
    

    worked for me!

    Now, when exporting PDF, all the charts display correctly.
    I'm on version 5.0 of Superset.

  15. AdityaKothari27 commented on Feb 5, 2026

    @AdityaKothari27

    FEATURE_FLAGS = {
    "DASHBOARD_VIRTUALIZATION": False,
    }

    This worked for me but I came across a weird bug.

    When I click on the menu for dashboard options, the "Refresh dashboard" and "Download" buttons are disabled.

    Image

    but after pressing Win+Shift+s for taking a screenshot and select the menu as the screenshot region, it gets enabled instantly.

    Image

    But the pdf does get all the charts though, no more loading symbols.

  16. marked Exporting issue #29394 as a duplicate of this issue on Jun 1, 2026
  17. rusackas commented on Jul 21, 2026

    @rusackas
    Member

    Dug into this. Download as PDF/Download as Image run client-side through dom-to-pdf/html2canvas in the user's own browser, not through the headless report worker, so the isCurrentUserBot() bypass that already skips DASHBOARD_VIRTUALIZATION for scheduled reports and thumbnails never kicks in there. Off-screen charts stay unmounted when the snapshot is taken, which lines up with why disabling the flag fixes it for everyone here. Might be worth teaching downloadAsPdf/downloadAsImage to force a full render before capturing, same as the bot path already does. Seeing if I can track down a fix.

  18. jenwitteng commented on Jul 29, 2026

    @jenwitteng
    Contributor

    @rusackas your diagnosis matches exactly what I hit. Download as Image/Download as PDF capture the live DOM client-side, so the isCurrentUserBot() bypass that covers scheduled reports and thumbnails never applies, and any row unmounted by DASHBOARD_VIRTUALIZATION is captured as a <Loading> spinner. Disabling the flag "fixes" it only because every chart then stays mounted.

    I built a fix for this on our fork a while back and it's held up in production. The approach is the "force a full render before capturing" one you suggested:

    1. A pair of window events — superset-force-all-in-view / superset-restore-virtualization. Row listens: on force it disconnects its IntersectionObservers and renders; on restore it re-observes.
    2. downloadAsImage/downloadAsPdf dispatch the force event, poll until the .loading spinners inside the capture container clear (timeout + "export may be incomplete" toast), capture, then restore on every exit path (including error/early-return, so a failed export never leaves virtualization disabled for the session). All gated on DASHBOARD_VIRTUALIZATION.

    Are you still working on a fix? If not, I'm happy to open a PR with this — I have it ready to go. Didn't want to duplicate anything you have in flight.

  19. rusackas commented on Jul 30, 2026

    @rusackas
    Member

    Thanks for following through with #42561, @jenwitteng. Looks like the right shape for the fix, and CI's green. Reviews/testing encouraged from anyone reading this :)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions