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

Fix GIFs not loading in production #72

Merged

Conversation

raymosun
Copy link
Contributor

@raymosun raymosun commented Sep 21, 2023

Info

Closes #60. (If there is no issue for this pull request yet, please create one or
delete this line if the pull request is for a very minor tweak).

Description

Next Image optimization doesn't support animated images including GIFs. Optimization is supposed to be automatically disabled for GIFs, but it looks like their detector isn't working properly on our URLs (possibly due to extra parameters after the .gif. This commit manually disables optimization for gifs.

Changes

  • Added the isSrcAGif function to utils.js that checks for gifs using a new regex.
  • Profile pictures on leaderboard page have the manual check (Note: function may need to be called wherever user submitted images are displayed)

Type of Change

  • Bug Fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as
    expected)
  • Logistics Change (A change to a README, description, or dev workflow setup like
    linting/formatting)
  • Continuous Integration Change (Related to deployment steps or continuous integration
    workflows)
  • Other: (Fill In)

Testing

I have tested that my changes fully resolve the linked issue ...

  • locally on Desktop.
  • locally on mobile - use https://ngrok.io to get a copy on a mobile device
  • on the live deployment preview on Desktop.
  • on the live deployment preview on Mobile.
  • I have run and passed all new and existing Cypress tests. Add screenshots below.

Checklist

  • I have performed a self-review of my own code.
  • I have followed the style guidelines of this project.
  • I have documented my code's src/lib functions and commented hard to understand areas
    anywhere else.
  • My changes produce no new warnings.

Screenshots

Please include a screenshot of your Cypress testing suite passing successfully.

If you made any visual changes to the website, please include relevant screenshots below.

@raymosun raymosun linked an issue Sep 21, 2023 that may be closed by this pull request
@vercel
Copy link

vercel bot commented Sep 21, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
membership-portal-ui-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 23, 2023 0:05am

Copy link
Contributor

@trevorkw7 trevorkw7 left a comment

Choose a reason for hiding this comment

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

It's a shame that next/image doesn't seem to have better optimization support for GIFs but this manual solution does the job for the foreseeable future! Might want to revisit at some point if next/image gets updated options.

@raymosun raymosun merged commit 600c7c1 into main Oct 2, 2023
@raymosun raymosun deleted the 60-gifs-dont-load-on-production-and-test-deploy-leaderboard branch October 2, 2023 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GIFs don't load on production and test deploy leaderboard
3 participants