Data property gets mutated.
When toggling datasets on and off repeatedly we sometimes get a crash. When using Redux the points array would be mutated and contain older data.
It seems like the copying is not enough in: https://github.com/jerairrest/react-chartjs-2/blob/master/src/index.js#L141
Its should probably copy the graph points in data array as well.
I'm not sure if you're seeing the same issue that we recently saw. However, we also saw a crash when we toggled datasets on and off. We found out that this was due to creating new datasets with the same dataset.data from previous datasets.
When we created datasets without changing the data array and then toggled the datasets, the crashes went away.
From what I've read, adding/removing points from the data array should also work, but I haven't tried it (our data array stays static for our app).
Hope this helps.
@FilipAndersson245 You're absolutely right! Proper solution would be to deep clone dataset not just do shallow copy with spread operator.
Is there any plans to fix this? I wasn't expecting the library to mutate any data passed to it, so it took me a couple of hours to debug and understand what was going on.
@FilipAndersson245 @bdwade100 @apieceofbart @rafaelbiten Hi. Would you please try the latest react-chartjs-2 version? Is this issue still there?
Closed due to inactivity.