From d86af6456060b3bd1f10b3442e034cbf5c6f71df Mon Sep 17 00:00:00 2001 From: Sophia Mersmann Date: Tue, 17 Sep 2024 09:46:58 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20(explorer)=20remove=20duplicate?= =?UTF-8?q?=20columns=20(#3957)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- baker/siteRenderers.tsx | 8 +++++++- explorer/Explorer.tsx | 19 +++++-------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/baker/siteRenderers.tsx b/baker/siteRenderers.tsx index 678d1685c11..4730d236056 100644 --- a/baker/siteRenderers.tsx +++ b/baker/siteRenderers.tsx @@ -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 diff --git a/explorer/Explorer.tsx b/explorer/Explorer.tsx index ade08649379..42837cab502 100644 --- a/explorer/Explorer.tsx +++ b/explorer/Explorer.tsx @@ -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)