Closed mattsbennett closed 2 months ago
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 useState
setter in the event handler), the chart zoom resets, which seems unexpected.
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 onDataZoom
(and onRestore
). Maybe that's the intent of the design? Not sure, though I found it unexpected.
@mattsbennett this issue is fixed in v1.3.0
.
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 v1.3.1
. Sorry for the incoveniences
@hugocxl no problem, thank you! 1.3.1
resolves the render issue; however I've noticed one additional regression - now the charts don't dynamically resize on viewport width changes (though they still layout responsively on initial load). I've updated my stackblitz example to 1.3.1
(https://stackblitz.com/edit/react-xfumjc?file=package.json,src%2FApp.js,src%2FApp.js). To reproduce:
1.3.1
1.2.1
again by entering @kbox-labs/react-echarts@1.2.1
in the "Enter package name" fieldEdit: 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