Skip to content

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

Open
sreeja-apparaju wants to merge 6 commits into
masterfrom
162-user-not-always-seeing-heatmap-legend-reset-to-city-after-mousing-out-of-heatmap-neighborhoods-1
Open

162 user not always seeing heatmap legend reset to city after mousing out of heatmap neighborhoods 1#167
sreeja-apparaju wants to merge 6 commits into
masterfrom
162-user-not-always-seeing-heatmap-legend-reset-to-city-after-mousing-out-of-heatmap-neighborhoods-1

Conversation

@sreeja-apparaju

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

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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.

@francisli francisli left a comment

Copy link
Copy Markdown
Collaborator

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