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

plotOptions events issue when using state/redux #229

Open
leonardolessa opened this issue Sep 25, 2019 · 7 comments
Open

plotOptions events issue when using state/redux #229

leonardolessa opened this issue Sep 25, 2019 · 7 comments
Labels
needs Highcharts fix Requires a fix on Highcharts, rather than this wrapper

Comments

@leonardolessa
Copy link

Bug or Feature Request?

Bug

Description

When you define events inside plotOptions, it look like the previous event listeners are not "dead" as you change the state, or someway the previous state keeps stored.

How to reproduce

Define an event inside plotOptions object and try to interact with state (or redux state) as it changes. At some point you'll get the previous state value.

In my project, I'm beeing able to reproduce using the redux state, for some reason the chart event gets several previous values of the redux store.

Live demo demonstrating bug

https://stackblitz.com/edit/react-1wm1vu
Just keep looking at the console and mouseOvering the chart until the state changes, the logger will log both null and "testing" after the state changes.

Versions

  • React JSX Highcharts version: 3.6.1 and 4.0.0-alpha
  • Highcharts version: 7.2.0
  • React version: 16.9.0
@leonardolessa
Copy link
Author

I was testing again and It looks like the points that were hovered before the state changes, always get the previous values after the change. I could reproduce with the click event too, inside "series" property, but in this case the state value is always the initial one (null).

@anajavi anajavi added the needs Highcharts fix Requires a fix on Highcharts, rather than this wrapper label Sep 26, 2019
@anajavi
Copy link
Collaborator

anajavi commented Sep 26, 2019

This is a bug on Highcharts side.

I created a reproduction with pure Highcharts in https://jsfiddle.net/vopcu8mt/

@anajavi
Copy link
Collaborator

anajavi commented Sep 26, 2019

I created a issue in Highcharts repository: highcharts/highcharts#12067

@anajavi
Copy link
Collaborator

anajavi commented Sep 26, 2019

This can be actually worked around on react-jsx-highcharts, but let's see what Highcharts has to say about it first.

@leonardolessa as you have tried the v4 alpha, can you share your experience in #228, or just add +1 if it works for you?

@leonardolessa
Copy link
Author

Hi @anajavi, thanks a lot for your quick response, I really appreciate it.

I've briefly tested v4 alpha to reproduce the issue, but I'll have a try until the end of the day in my charts, I use a lot of features of this lib so I guess I can be helpful.

Thanks again!

@anajavi
Copy link
Collaborator

anajavi commented Sep 26, 2019

I don't know if your real world case can be worked around with useRef, but here's edited stackblitz which works with it:
https://stackblitz.com/edit/react-znpnkp?file=Hello.js

It's just a workaround though, a real fix is needed.

@anajavi
Copy link
Collaborator

anajavi commented Sep 27, 2019

It seems that this can't be worked around in react-jsx-highcharts. We have to wait for Highcharts to fix the bug.

@anajavi anajavi removed the bug label Sep 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs Highcharts fix Requires a fix on Highcharts, rather than this wrapper
Projects
None yet
Development

No branches or pull requests

2 participants