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

Fix error when opening legend #784

Merged
merged 2 commits into from
Feb 10, 2023
Merged

Fix error when opening legend #784

merged 2 commits into from
Feb 10, 2023

Conversation

1ec5
Copy link
Member

@1ec5 1ec5 commented Feb 10, 2023

This PR fixes a regression from #773 that produces an error when opening the legend: #774 (comment). If there’s no “Route markers” section because no route markers are visible in the current viewport, then there are no pending rows and no need to regenerate them with Wikidata labels.

@1ec5 1ec5 added bug Something isn't working shields labels Feb 10, 2023
@@ -686,8 +686,9 @@ export default class LegendControl {
if (!networkMetadata) return;

let section = document.getElementById("legend-section-shields");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could pull this statement up to the top of the method and short-circuit fetching the metadata from Wikidata. But even if that query runs unnecessarily the first time the user opens the legend, it avoids a flash of raw tag values when opening the legend again in the presence of shields. I think this is a better user experience worth the cost of a relatively small request.

@1ec5 1ec5 force-pushed the 1ec5-legend-no-shield-section-774 branch from 823e116 to 653b8a0 Compare February 10, 2023 01:04
Copy link
Member

@ZeLonewolf ZeLonewolf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@1ec5 1ec5 merged commit a31e532 into main Feb 10, 2023
@1ec5 1ec5 deleted the 1ec5-legend-no-shield-section-774 branch February 10, 2023 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working shields
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants