Skip to content

Commit

Permalink
Merge pull request #3662 from owid/fix-static-exports
Browse files Browse the repository at this point in the history
🐛 don't fallback to static export views of charts by default on mobile
  • Loading branch information
ikesau authored May 28, 2024
2 parents 8823bf7 + e8d0f50 commit f2c83e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 2 additions & 0 deletions site/GrapherImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export default function GrapherImage({
return (
<img
className="GrapherImage"
// TODO: use the CF worker to render these previews so that we can show non-default configurations of the chart
// https://github.com/owid/owid-grapher/issues/3661
src={`${BAKED_GRAPHER_EXPORTS_BASE_URL}/${slug}.svg`}
alt={alt}
width={DEFAULT_GRAPHER_WIDTH}
Expand Down
13 changes: 6 additions & 7 deletions site/multiembedder/MultiEmbedder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
fetchText,
getWindowUrl,
isArray,
isMobile,
isPresent,
Url,
GrapherTabOption,
Expand Down Expand Up @@ -53,13 +52,13 @@ const figuresFromDOM = (
// Determine whether this device is powerful enough to handle
// loading a bunch of inline interactive charts
// 680px is also used in CSS – keep it in sync if you change this
export const shouldProgressiveEmbed = () =>
!isMobile() ||
window.screen.width > 680 ||
pageContainsGlobalEntitySelector()
export const shouldProgressiveEmbed = () => true
// disabling this behaviour for now until we have a better way to detect low power devices
// https://github.com/owid/owid-grapher/issues/3661
// !isMobile() || window.screen.width > 680 || pageContainsGlobalEntitySelector()

const pageContainsGlobalEntitySelector = () =>
globalEntitySelectorElement() !== null
// const pageContainsGlobalEntitySelector = () =>
// globalEntitySelectorElement() !== null

const globalEntitySelectorElement = () =>
document.querySelector(GLOBAL_ENTITY_SELECTOR_ELEMENT)
Expand Down

0 comments on commit f2c83e3

Please sign in to comment.