Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Topic-specific country profile pages don't show data for the country #3931

Closed
rakyi opened this issue Sep 6, 2024 · 3 comments · Fixed by #3963
Closed

Topic-specific country profile pages don't show data for the country #3931

rakyi opened this issue Sep 6, 2024 · 3 comments · Fixed by #3963

Comments

@rakyi
Copy link
Contributor

rakyi commented Sep 6, 2024

Description

On topic-specific country profile pages, charts use the default country selection instead of the specific country. For example, here charts should show the data for Spain.

It seems to work correctly for explorers.

Additional context

@ikesau
Copy link
Member

ikesau commented Sep 10, 2024

Looks like this was introduced via #3793

Bug is present in its deployment: https://035fd218.owid.pages.dev/energy/country/spain

But not in the prior deployment: https://e7fd384b.owid.pages.dev/energy/country/spain

@ikesau
Copy link
Member

ikesau commented Sep 10, 2024

@sophiamersmann when you get back could you please take a look at this? 🙂

@sophiamersmann
Copy link
Member

Probably related to #1473

@sophiamersmann sophiamersmann self-assigned this Sep 13, 2024
sophiamersmann added a commit that referenced this issue Sep 17, 2024
Fixes #3931 

The global entity selector manages the selection of a chart from outside by passing in its own `selection` object, which should take precedence over the config's `selectedEntityNames`.  

In #3793, Grapher's `updateFromObject` method was updated to also change the current selection if `selectedEntityNames` is given. That's sensible (and is needed in the admin), but `updateFromObject` is also called in the constructor. If `selectedEntityNames` and `selection` both are given then `selectedEntityNames` always won, which broke the global entity selector (since it relies on `selection` being respected).

I think it's sensible to apply the passed-in selection only if it's non-empty, but this leads to funny behaviour of the global entity selector if the selection happens to be empty (e.g., http://staging-site-fix-global-entity-selector/energy/country/spain?country=). But, apparently, even before #3793, the global entity selector has behaved weirdly for empty selections (e.g., https://e7fd384b.owid.pages.dev/energy/country/spain?country=). It's not ideal, but I don't think it's too bad.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants