Skip to content

Commit

Permalink
🐛 migrate configs on the fly when fetched from R2
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Dec 3, 2024
1 parent d251b43 commit 4685e31
Show file tree
Hide file tree
Showing 2 changed files with 357 additions and 2 deletions.
8 changes: 6 additions & 2 deletions site/multiembedder/MultiEmbedder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
hydrateGlobalEntitySelectorIfAny,
migrateSelectedEntityNamesParam,
SelectionArray,
migrateGrapherConfigToLatestVersion,
} from "@ourworldindata/grapher"
import {
fetchText,
Expand Down Expand Up @@ -200,8 +201,11 @@ class MultiEmbedder {
} else {
configUrl = `${GRAPHER_DYNAMIC_CONFIG_URL}/${slug}.config.json`
}
const grapherPageConfig = await fetchWithRetry(configUrl).then(
(res) => res.json()
const fetchedGrapherPageConfig = await fetchWithRetry(
configUrl
).then((res) => res.json())
const grapherPageConfig = migrateGrapherConfigToLatestVersion(
fetchedGrapherPageConfig
)

const figureConfigAttr = figure.getAttribute(
Expand Down
351 changes: 351 additions & 0 deletions vite.config-site.mts.timestamp-1733219525800-65e741a934f3d.mjs

Large diffs are not rendered by default.

0 comments on commit 4685e31

Please sign in to comment.