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 Nov 27, 2024
1 parent 5324762 commit b875dc8
Showing 1 changed file with 6 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 @@ -199,8 +200,11 @@ class MultiEmbedder {
} else {
configUrl = `${GRAPHER_DYNAMIC_CONFIG_URL}/${slug}.config.json`
}
const grapherPageConfig = await fetch(configUrl).then((res) =>
res.json()
const fetchedGrapherPageConfig = await fetch(configUrl).then(
(res) => res.json()
)
const grapherPageConfig = migrateGrapherConfigToLatestVersion(
fetchedGrapherPageConfig
)

const figureConfigAttr = figure.getAttribute(
Expand Down

0 comments on commit b875dc8

Please sign in to comment.