Skip to content

Commit

Permalink
🐛 fix global entity selector
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Sep 17, 2024
1 parent d86af64 commit afb5731
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/@ourworldindata/grapher/src/core/Grapher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import {
getOriginAttributionFragments,
sortBy,
extractDetailsFromSyntax,
omit,
} from "@ourworldindata/utils"
import {
MarkdownTextWrap,
Expand Down Expand Up @@ -505,7 +506,14 @@ 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.
// this is necessary for the global entity selector to work correctly.
if (props.manager?.selection?.hasSelection) {
this.updateFromObject(omit(props, "selectedEntityNames"))
} else {
this.updateFromObject(props)
}

if (!props.table) this.downloadData()

Expand Down

0 comments on commit afb5731

Please sign in to comment.