diff --git a/explorer/ExplorerProgram.ts b/explorer/ExplorerProgram.ts index 5d82ce4f2b3..0e5934d1f4e 100644 --- a/explorer/ExplorerProgram.ts +++ b/explorer/ExplorerProgram.ts @@ -18,8 +18,8 @@ import { PromiseCache, SerializedGridProgram, trimObject, - mergeGrapherConfigs, merge, + isEmpty, } from "@ourworldindata/utils" import { CellDef, @@ -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 }