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

🔨 Switch grapher exports to use CF worker #4464

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

ikesau
Copy link
Member

@ikesau ikesau commented Jan 17, 2025

Resolves #4093 and #3661

Supersedes #3746 and #4099

Changes

  • Switches all references to /exports/ to use our dynamic thumbnails instead
  • Removes code that baked graphers to /exports/
    • Some charts in country profiles will no longer load in the NoJS version of the site because their slugs have updated but formatWordpressPost isn't checking redirects. We could:
      1. Fix this in the code
      2. Update the country profile templates
      3. Not fix it
  • In all thumbnail imgs where applicable, switches the image extension from .svg to .png, to ensure webfonts always show correctly.
  • Removes InteractionNotice

Caveats

  • NoJS country profile pages are still a bit broken, as they don't have the correct entity selected, nor do they take redirects into account

@owidbot
Copy link
Contributor

owidbot commented Jan 17, 2025

Quick links (staging server):

Site Dev Site Preview Admin Wizard Docs

Login: ssh owid@staging-site-remove-grapher-exports

SVG tester:

Number of differences (default views): 770 (7e5427) ❌
Number of differences (all views): 352 (ca1a58) ❌

Edited: 2025-01-23 20:58:24 UTC
Execution time: 1.23 seconds

@ikesau
Copy link
Member Author

ikesau commented Jan 17, 2025

This is blocked by #4450

So I'm going to work on that now

@ikesau ikesau force-pushed the remove-grapher-exports branch from 3f6aeab to d38cba1 Compare January 22, 2025 15:29
import path from "path"
import sharp from "sharp"
import svgo from "svgo"
Copy link
Member Author

Choose a reason for hiding this comment

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

We still use svgo in the flag updater dev tool

@@ -1,16 +0,0 @@
export const INTERACTIVE_ICON_SVG = `<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="hand-pointer" class="svg-inline--fa fa-hand-pointer fa-w-14" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 617">
Copy link
Member Author

Choose a reason for hiding this comment

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

Deleting InteractionNotice because we weren't using it.

shouldProgressiveEmbed has been hard-coded to true for the last year, so all mobile devices have been embedding charts normally.

Which means that the only time this would render is if JS was disabled, but we were hiding the notice when JS was disabled because it doesn't make sense to explain to the user that clicking on the thumbnail will load an interactive chart in that case 🙃

We could have rewritten shouldProgressiveEmbed, but I think we can circle back to that if/once #4377 is done.

@ikesau ikesau requested a review from marcelgerber January 22, 2025 22:23
Copy link
Member

@marcelgerber marcelgerber left a comment

Choose a reason for hiding this comment

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

Nice!

You went a bit over the top in MultiEmbedder though, effectively making all non-standalone charts static. Which is good for testing this, but... 😀

baker/formatWordpressPost.tsx Show resolved Hide resolved
ops/buildkite/deploy-content Outdated Show resolved Hide resolved
site/search/ChartHit.tsx Outdated Show resolved Hide resolved
site/multiembedder/MultiEmbedder.tsx Outdated Show resolved Hide resolved
@ikesau ikesau force-pushed the remove-grapher-exports branch from d2013dd to 14a3108 Compare January 23, 2025 20:51
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.

Webfonts aren't loading correctly in Grapher SVG thumbnails
3 participants