Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asynchronously load libraries for png and pdf exports #41036

Merged
merged 2 commits into from Apr 4, 2024

Conversation

alxnddr
Copy link
Member

@alxnddr alxnddr commented Apr 4, 2024

Epic #41032

Description

Reduces the size of the vendor bundle by extracting heavy libraries used for pdf and png exports which should not block the initial app loading.

Before
Screenshot 2024-04-04 at 11 19 37 AM

After
Screenshot 2024-04-04 at 11 13 33 AM

How to verify

  • Ensure png and pdf exports are not broken
  • Using webpack bundle analyzer you can confirm the vendor chunk size

Demo

Screen.Recording.2024-04-04.at.11.09.18.AM.mov

@alxnddr alxnddr requested review from a team April 4, 2024 15:36
@metabase-bot metabase-bot bot added .Team/DashViz Dashboard and Viz team visual Run Percy visual testing labels Apr 4, 2024
@@ -17,6 +14,7 @@ export const saveDashboardPdf = async (
return;
}

const { default: html2canvas } = await import("html2canvas");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'd keep import on the top level, but with import(), so the new chunk will be created automatically and at the same time user will not need to wait for chunk to be downloaded after a click to "download"

actually if you already wait for downloading some big file, chunk loading is not a problem, so please ignore my comment

@alxnddr alxnddr added the backport Automatically create PR on current release branch on merge label Apr 4, 2024
Copy link

replay-io bot commented Apr 4, 2024

Status Complete ↗︎
Commit 4fe624c
Results
⚠️ 13 Flaky
2391 Passed

@alxnddr alxnddr merged commit 8fe94af into master Apr 4, 2024
111 checks passed
@alxnddr alxnddr deleted the async-load-heavy-libs-for-exports branch April 4, 2024 18:31
Copy link

github-actions bot commented Apr 4, 2024

@alxnddr Did you forget to add a milestone to the issue for this PR? When and where should I add a milestone?

metabase-bot bot added a commit that referenced this pull request Apr 4, 2024
Co-authored-by: Aleksandr Lesnenko <alxnddr@users.noreply.github.com>
@WiNloSt WiNloSt added this to the 0.49.4 milestone Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Automatically create PR on current release branch on merge .Team/DashViz Dashboard and Viz team visual Run Percy visual testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants