From 79899956f4e9989536d2db73ed239f47c73f43e5 Mon Sep 17 00:00:00 2001 From: sophiamersmann Date: Mon, 16 Sep 2024 15:44:08 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20global=20entity=20selector?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/@ourworldindata/grapher/src/core/Grapher.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/@ourworldindata/grapher/src/core/Grapher.tsx b/packages/@ourworldindata/grapher/src/core/Grapher.tsx index 2f77b7d1250..72316bece41 100644 --- a/packages/@ourworldindata/grapher/src/core/Grapher.tsx +++ b/packages/@ourworldindata/grapher/src/core/Grapher.tsx @@ -65,6 +65,7 @@ import { getOriginAttributionFragments, sortBy, extractDetailsFromSyntax, + omit, } from "@ourworldindata/utils" import { MarkdownTextWrap, @@ -505,7 +506,13 @@ export class Grapher if (props) this.setAuthoredVersion(props) - this.updateFromObject(props) + // prefer the manager's selection over the config's selectedEntityNames + // if both are passed in and the manager's selection is not empty + if (props.manager?.selection?.hasSelection) { + this.updateFromObject(omit(props, "selectedEntityNames")) + } else { + this.updateFromObject(props) + } if (!props.table) this.downloadData()