stop page from jumping during load #11

Closed
opened 2025-09-09 19:41:42 -05:00 by Octech6711 · 1 comment
Owner

Originally created by @LWinterberg on GitHub.

our react components (in particular releasevideo.jsx and shareyoursounds.jsx) currently determine their size after the initial render, causing pages to shift. pagespeed.web.dev doesn't like that and fails us for the core web vitals which allegedly is an SEO factor.

https://web.dev/articles/cls

We possibly can fix this by using useLayoutEffect in the elements in question so the size is there before any painting happens. In practice, I've only been able to make the stuff inside the thing load together with the element, not the other way round.
https://react.dev/reference/react/useLayoutEffect

Originally created by @LWinterberg on GitHub. our react components (in particular releasevideo.jsx and shareyoursounds.jsx) currently determine their size after the initial render, causing pages to shift. pagespeed.web.dev doesn't like that and fails us for the core web vitals which allegedly is an SEO factor. https://web.dev/articles/cls We possibly can fix this by using useLayoutEffect in the elements in question so the size is there before any painting happens. In practice, I've only been able to make the stuff inside the thing load together with the element, not the other way round. https://react.dev/reference/react/useLayoutEffect
Author
Owner

@LWinterberg commented on GitHub:

on further inspection, it seems like changing client:only to client:load fixes the thing from jumping about. @DilsonsPickles any reason we need client:only rendering? from the looks of it, the download button points to the /download before the JS loads in, which is fine in my eyes

@LWinterberg commented on GitHub: on further inspection, it seems like changing `client:only` to `client:load` fixes the thing from jumping about. @DilsonsPickles any reason we need client:only rendering? from the looks of it, the download button points to the /download before the JS loads in, which is fine in my eyes
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: audacity/audacity.github.io#11