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

[Perf] Lazy load site banner #10899

Merged
merged 1 commit into from
Jul 8, 2024
Merged

[Perf] Lazy load site banner #10899

merged 1 commit into from
Jul 8, 2024

Conversation

esizer
Copy link
Member

@esizer esizer commented Jul 5, 2024

🤖 Resolves #10897

👋 Introduction

Updates the site banner to be dynamically imported so it does not need to load when there is no message to be displayed.

🕵️ Details

Since the banner contains rich text, we need to load tiptap to render the data. Tiptap is one of our larger libraries (307kb) so we should only load it when we need it.

🧪 Testing

  1. Build pnpm run dev:fresh
  2. Navigate to the homepage
  3. Confirm tip tap is not loaded
  4. Enable the banner
  5. Navigate home
  6. Confirm tiptap is loaded and banner renders

📸 Screenshot

Not loaded

screenshot_05-Jul-2024_12-08-1720195696

Loaded

screenshot_05-Jul-2024_12-11-1720195864

@codecov-commenter
Copy link

codecov-commenter commented Jul 5, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.

Project coverage is 38.69%. Comparing base (44cc729) to head (3ba4ed6).
Report is 1 commits behind head on main.

Files Patch % Lines
apps/web/src/components/Layout/BannerContent.tsx 0.00% 4 Missing ⚠️
apps/web/src/components/Layout/SitewideBanner.tsx 0.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #10899      +/-   ##
============================================
- Coverage     38.70%   38.69%   -0.01%     
  Complexity     1656     1656              
============================================
  Files          1013     1014       +1     
  Lines         30923    30928       +5     
  Branches       6429     6431       +2     
============================================
  Hits          11968    11968              
- Misses        18921    18924       +3     
- Partials         34       36       +2     
Flag Coverage Δ
integrationtests 68.17% <ø> (ø)
unittests 31.49% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@petertgiles petertgiles self-requested a review July 8, 2024 12:40
Copy link
Contributor

@petertgiles petertgiles left a comment

Choose a reason for hiding this comment

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

Cool, clean, clever! 🥇

@esizer esizer added this pull request to the merge queue Jul 8, 2024
Merged via the queue into main with commit f0f8c72 Jul 8, 2024
9 checks passed
@esizer esizer deleted the 10897-lazy-load-banner-content branch July 8, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

♻️ Lazy load SitewideBanner
3 participants