signup: fetch the page's LCP images eagerly - #1694
Conversation
Field LCP data flags both signup illustrations as slow: the desktop hero (signup-main.svg) and the first option card (undraw-mailbox.svg, the LCP element on mobile where the hero is hidden) were default-lazy. Preload the hero via a media-gated link so mobile keeps skipping the file while desktop fetches it from the head, and mark the first card priority with explicit fetchpriority.
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
PR Summary by QodoPrioritize responsive signup LCP image loading
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can start a comment with 'qodo' or '@qodo' to chat about any finding |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe signup page now uses viewport-specific preloads for the desktop hero and the first mobile option image. Signup images remain lazy-loaded. Tests cover desktop, mobile, sub-page, and later-card loading behavior. ChangesSignup LCP image loading
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change selectively preloads the signup page’s likely LCP images while preserving lazy loading and responsive behavior; no actionable merge-blocking risk remains beyond normal checks and review. Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The changes address issue
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review finding: priority on the mailbox image applied at every breakpoint, so at md+ its unconditional preload and high-priority fetch competed with the hero, which is the actual desktop LCP element. Mirror the hero's treatment instead: a media-gated mobile preload while the card <img> stays lazy everywhere.
Closes #1693
The desktop hero (
signup-main.svg) and the signup option card illustrations were default-lazynext/image, and CF field data shows both among the slowest LCP elements (hero 5.8s on desktop, mailbox card 12.3s on mobile where the hero ishidden md:blockand the card becomes the LCP element).Both LCP images now get a media-gated
<link rel=preload as=image fetchpriority=high>while their<img>s stay lazy:(min-width: 768px). The container is display:none below md and a lazy image with no box is never fetched, so mobile keeps skipping the 47KB file while desktop starts the fetch from the head.(max-width: 767px), the complement. At md+ the hero is the LCP element and an ungated high-priority card fetch would compete with it, so only mobile (where the card IS the LCP element) fetches early.Spec pins the preload attributes including both media gates, the images staying lazy, no preload on header-less sub-pages and no preload for the other cards. Each assertion was mutation-tested (guard removed, spec fails).
Validated: signup specs 13/13, eslint and tsc clean.
Summary by CodeRabbit
Performance Improvements
Tests