-
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
Duplicate event handlers bound on every render #45
Comments
Hi @mattsbennett, great finding! Let me find some time to look into the issue. |
Thanks @hugocxl ! I think there's an additional bug here; on clicking any of the points (with the I worked around this by making x and y zoom start/end values stateful as well, storing the values in state and updating them via |
@mattsbennett this issue is fixed in Could you check whether the last commented issue is fixed in this version? Thanks! |
@hugocxl I've updated my stackblitz example (https://stackblitz.com/edit/react-xfumjc?file=package.json,src%2FApp.js,src%2FApp.js) to 1.3.0, with no other changes and now it seems the chart doesn't load/render at all. |
@mattsbennett absolutely. My bad, I based my previous solution in the Suspense API not taking into account that there might be projects where is not being used. I have reverted this change and it's working in your example properly with |
@hugocxl no problem, thank you!
Edit: Added a new issue for this :-) |
Description
When event handlers contain react
useState
setters, duplicate event handlers are bound. The cause:This results in event handlers being duplicated (an additional duplicate handler is bound every time the component is rendered). A simple solution would be the following:
Link to Reproduction
https://stackblitz.com/edit/react-xfumjc?file=package.json,src%2FApp.js,src%2FApp.js
Steps to reproduce
setStateData(params.value)
inonChartClick
JS Framework
React (JS)
Version
1.2.1
Browser
No response
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: