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

refactor(lib-content): reduce home and about page load times #6255

Merged
merged 6 commits into from
Sep 16, 2024

Conversation

eatyourgreens
Copy link
Contributor

@eatyourgreens eatyourgreens commented Aug 31, 2024

Use YouTubeEmbed, from @next/third-parties/google, for video embeds on the home and about pages. This should reduce the JS download size by ~2.5MB per video.

Lazy-load offscreen images, for faster page performance.

Please request review from @zooniverse/frontend team or an individual member of that team.

Package

  • lib-content

Linked Issue and/or Talk Post

How to Review

The YouTube videos should still appear on the home page, but the overall page weight should be much smaller. I've given each video an accessible title too.

Lighthouse scores, in Chrome, should be a lot better here (although a local server on your laptop will always serve pages faster than a Node server running in the cloud.) Lighthouse should report a total network payload of ~5MB here, compared to ~15MB for https://fe-root.preview.zooniverse.org.

Here's the Lighthouse performance report for this branch running on an M3 MacBook Pro:
Performance: 97, Accessibility: 96, Best Practice: 96, SEO:58

Here's the Lighthouse report for https://fe-root.preview.zooniverse.org on the same MacBook:
Performance: 88, Accessibility: 96, Best Practice: 96, SEO: 58

Incidentally, SEO scores are low because 8 links have the generic 'Read more' as the link text.
SEO errors from the Lighthouse report, where links to blog posts use 'Read more' as the link text.

Checklist

PR Creator - Please cater the checklist to fit the review needed for your code changes.
PR Reviewer - Use the checklist during your review. Each point should be checkmarked or discussed before PR approval.

General

  • Tests are passing locally and on Github
  • Documentation is up to date and changelog has been updated if appropriate
  • You can yarn panic && yarn bootstrap or docker-compose up --build and FEM works as expected
  • FEM works in all major desktop browsers: Firefox, Chrome, Edge, Safari (Use Browserstack account as needed)
  • FEM works in a mobile browser

General UX

Example Staging Project: i-fancy-cats

  • All pages of a FEM project load: Home Page, Classify Page, and About Pages
  • Can submit a classification
  • Can sign-in and sign-out
  • The component is accessible

Refactoring

  • The PR creator has described the reason for refactoring
  • The refactored component(s) continue to work as expected

@coveralls
Copy link

coveralls commented Aug 31, 2024

Coverage Status

coverage: 78.784% (-0.03%) from 78.809%
when pulling eca456e on eatyourgreens:lite-youtube-embed
into 232fa24 on zooniverse:master.

@eatyourgreens eatyourgreens changed the title refactor(lib-content): use lite-youtube-embed for video embeds refactor(lib-content): faster home page performance Sep 1, 2024
@eatyourgreens eatyourgreens force-pushed the lite-youtube-embed branch 2 times, most recently from bce80b9 to a83b45f Compare September 10, 2024 16:35
Use `YouTubeEmbed`, from `@next/third-parties/google`, for video embeds on the home page. This should reduce the JS download size by ~2.5MB per video.
@eatyourgreens eatyourgreens changed the title refactor(lib-content): faster home page performance refactor(lib-content): reduce home page load times Sep 11, 2024
- use `lite-youtube-embed`.
- lazy load offscreen images.
@eatyourgreens eatyourgreens changed the title refactor(lib-content): reduce home page load times refactor(lib-content): reduce home and about page load times Sep 12, 2024
Copy link
Contributor

@goplayoutside3 goplayoutside3 left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this!

fit='cover'
src={imageSrc}
alt={title}
loading='lazy'
Copy link
Contributor

@goplayoutside3 goplayoutside3 Sep 16, 2024

Choose a reason for hiding this comment

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

Not listed in Grommet's docs but does get passed on to the html element (loading) 👍

allowfullscreen
width='100%'
videoid='F-B8gXJyMHc'
title='A Brief Introduction to the Zooniverse'
Copy link
Contributor

Choose a reason for hiding this comment

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

This page has a translations dictionary. I'll add this string to it.

allowFullScreen
width='100%'
videoid='F-B8gXJyMHc'
title='A Brief Introduction to the Zooniverse'
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, I'll put this in the translations dictionary.

Comment on lines +66 to +68
['CaTNIoJy4Dg', 'Around the Zoo – Planet Hunters TESS'],
['8lZiZoBcMjE', 'Around the Zoo – Wildcam Gorongosa'],
['B6diEbpEblQ', 'Around the Zoo – Backyard Worlds'],
Copy link
Contributor

Choose a reason for hiding this comment

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

Not going to include these in the translations dictionary because it's a uniquely named series with Zooniverse project titles.

@goplayoutside3 goplayoutside3 merged commit 4bdd83b into zooniverse:master Sep 16, 2024
8 checks passed
@eatyourgreens eatyourgreens deleted the lite-youtube-embed branch September 16, 2024 05:18
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.

About page: excessively large JS leads to slow performance on mobile
3 participants