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

162 user not always seeing heatmap legend reset to city after mousing out of heatmap neighborhoods 1 #167

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

sreeja-apparaju
Copy link
Contributor

@sreeja-apparaju sreeja-apparaju commented Aug 2, 2023

modified onMouseOverZip function by setting a timeout to clear the selected feature after a short delay if the mouse moves out of the area

…reset-to-city-after-mousing-out-of-heatmap-neighborhoods-1
setSelectedFeature(null);
}, 100);

setResetTimeoutId(newTimeoutId);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Introducing this new state variable actually has more significant side effects than first appears. Because this function is dependent upon the variable, every time the variable is updated with the setter, it's going to trigger a redraw of the component and, because the map depends on this function, a redraw of the map.

The result is that, when the mouse is over the map, the browser enters into effectively an infinite loop of redraws until the mouse leaves the map. This is not really an efficient way to have the app run. To confirm this, add a console.log into this function. You'll see it print out repeatedly non-stop when the mouse is over a map.

Copy link
Collaborator

@francisli francisli left a comment

Choose a reason for hiding this comment

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

I'm not sure I want to accept this fix per the comment I left in the code. But, I don't have an idea yet of an alternative implementation...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User not always seeing heatmap legend reset to city after mousing out of heatmap neighborhoods
2 participants