Skip to content

Commit

Permalink
🐛 (explorer) remove duplicate columns (#3957)
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Sep 17, 2024
1 parent d5a1eed commit d86af64
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
8 changes: 7 additions & 1 deletion baker/siteRenderers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,13 @@ export const renderExplorerPage = async (
config: row.grapherConfigETL as string,
})
: {}
return mergeGrapherConfigs(etlConfig, adminConfig)
const mergedConfig = mergeGrapherConfigs(etlConfig, adminConfig)
// explorers set their own dimensions, so we don't need to include them here
const mergedConfigWithoutDimensions = lodash.omit(
mergedConfig,
"dimensions"
)
return mergedConfigWithoutDimensions
})

const wpContent = transformedProgram.wpBlockId
Expand Down
19 changes: 5 additions & 14 deletions explorer/Explorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -588,22 +588,13 @@ export class Explorer

// set given variable IDs as dimensions to make Grapher
// download the data and metadata for these variables
const dimensions = config.dimensions ?? []
const variablesToLoad = yVariableIdsList
// Filter out variableIds that are already present in the dimensions array
.filter(
(yVariableId) =>
!dimensions.some(
(d) =>
d.property === DimensionProperty.y &&
d.variableId === yVariableId
)
)
.map((yVariableId) => ({
const dimensions = config.dimensions?.slice() ?? []
yVariableIdsList.forEach((yVariableId) => {
dimensions.push({
variableId: yVariableId,
property: DimensionProperty.y,
}))
dimensions.push(...variablesToLoad)
})
})

if (xVariableId) {
const maybeXVariableId = parseIntOrUndefined(xVariableId)
Expand Down

0 comments on commit d86af64

Please sign in to comment.