Skip to content

Commit

Permalink
🐛 (explorer) remove mapTargetTime=0 from grapher config
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Oct 31, 2024
1 parent 45a5077 commit 7ff306f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion explorer/ExplorerProgram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import {
PromiseCache,
SerializedGridProgram,
trimObject,
mergeGrapherConfigs,
merge,
isEmpty,
} from "@ourworldindata/utils"
import {
CellDef,
Expand Down Expand Up @@ -409,6 +409,20 @@ export class ExplorerProgram extends GridProgram {
]
}

// because explorers used to ignore mapTargetTime=0, authors have been
// exploiting this behaviour to show the latest data on the map.
// this would be equivalent to not setting a mapTargetTime, but
// removing a column is more work than resetting all values,
// which is why authors have been relying on this behaviour.
// ideally, we'd clean up all explorers by removing all instances of
// mapTargetTime=0 and then remove this code, but realistically there
// is no rush since it's very unlikely that we'll ever create an explorer
// that actually wants to show the year 0 on a map by default
if (mergedConfig.map?.time === 0) {
delete mergedConfig.map.time
if (isEmpty(mergedConfig.map)) delete mergedConfig.map
}

return mergedConfig
}

Expand Down

0 comments on commit 7ff306f

Please sign in to comment.