-
Notifications
You must be signed in to change notification settings - Fork 8
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
base: master
Are you sure you want to change the base?
Conversation
…reset-to-city-after-mousing-out-of-heatmap-neighborhoods-1
setSelectedFeature(null); | ||
}, 100); | ||
|
||
setResetTimeoutId(newTimeoutId); |
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.
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.
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.
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...
modified onMouseOverZip function by setting a timeout to clear the selected feature after a short delay if the mouse moves out of the area