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 initial map state uncolored zones issue #6256

Merged
merged 4 commits into from
Dec 20, 2023

Conversation

Ugzuzg
Copy link
Contributor

@Ugzuzg Ugzuzg commented Dec 16, 2023

Issue

Closes #6136
Closes #6240

Description

The main issue is that isSourceLoaded inside the effect that renders the zones is not reactive and the change of the source state doesn't trigger a re-render of the component. Subscribing to that and changing the state fixes the issue.

Adding map to a dependency list of the effects makes sure that the map reference doesn't get stale in the closure and fixes the hot reload issue on my machine.

Preview

Double check

  • I have tested my parser changes locally with poetry run test_parser "zone_key"
  • I have run pnpx prettier --write . and poetry run format to format my changes.

@tonypls
Copy link
Collaborator

tonypls commented Dec 17, 2023

Thanks for looking into this!

I'm still getting the issue on firefox, now it's happening on every refresh on firefox for me.

image

@Ugzuzg
Copy link
Contributor Author

Ugzuzg commented Dec 18, 2023

I think, it should be fixed now.

@larkinox
Copy link

Just to confirm that I'm also still seeing this issue. Firefox 120.0.1 (64-bit), fresh visit to the map in a private browsing window. Happy to troubleshoot further if useful.

image

Copy link
Collaborator

@tonypls tonypls left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for fixing!

@tonypls
Copy link
Collaborator

tonypls commented Dec 20, 2023

Failing test is unrelated btw!

@tonypls tonypls merged commit ea88b3e into electricitymaps:master Dec 20, 2023
20 of 21 checks passed
@jayaddison
Copy link
Contributor

Thank you @Ugzuzg!

@Ugzuzg Ugzuzg deleted the fix/initial-load-zones branch December 20, 2023 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants