-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
🐛 fix global entity selector #3963
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @sophiamersmann and the rest of your teammates on Graphite |
Quick links (staging server):
Login:
SVG tester:Number of differences (default views): 0 ✅ Edited: 2024-09-16 13:52:57 UTC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Fixes the issue 👌
I think that the empty query param thing is only be an issue if someone gets linked to it that way.
If the user did it to themselves by unselecting the selected country, then I think they would understand why the charts aren't rendering properly.
So maybe, if you care enough, you could prune the empty ?country=
query param when the page mounts, before the embedder has started doing anything, and I think that should be fine because http://staging-site-fix-global-entity-selector/energy/country/new-zealand works?
Feel free to merge without that, though 🙂
7989995
to
afb5731
Compare
Yeah, that's a good suggestion, thank you, Ike! If I have time this week, I'll follow up with another PR, but I'll merge as-is for now to get the bug fixed. |
Merge activity
|
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'sselectedEntityNames
.In #3793, Grapher's
updateFromObject
method was updated to also change the current selection ifselectedEntityNames
is given. That's sensible (and is needed in the admin), butupdateFromObject
is also called in the constructor. IfselectedEntityNames
andselection
both are given thenselectedEntityNames
always won, which broke the global entity selector (since it relies onselection
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.