chartjs / chartjs-plugin-deferred

Chart.js plugin to defer initial chart updates
https://chartjs-plugin-deferred.netlify.app/
MIT License
110 stars 21 forks source link

Deferred update causes an uncaught error if `canvas` is destroyed #13

Closed BR0kEN- closed 3 years ago

BR0kEN- commented 4 years ago

It happens sometimes that canvas element and ctx are no longer exist during a deferred update. This causes errors like Cannot read property 'save' of null. To reproduce this behavior we have to construct a new chart and kill canvas before the delay is expired (e.g. when you navigate from one page to another without waiting for all charts to be rendered completely, including delayed updates).

Screenshot 2019-12-20 at 10 06 31 Screenshot 2019-12-20 at 10 06 48

ejosafat commented 3 years ago

any plan to incorporate @BR0kEN- fix to the main package? This error shows up in our E2E smoke testing suite as the test moves fast to the next screen without really leaving time for the chart to render.

BR0kEN- commented 3 years ago

There is no activity in this repo since 2018. I'm using "chartjs-plugin-deferred": "https://github.com/BR0kEN-/chartjs-plugin-deferred/tarball/v1.0.2", since the patch creation.

simonbrunel commented 3 years ago

@ejosafat @BR0kEN- I'm really sorry, I wasn't able to work on this project when the patch has been submitted and then I forgot about it. I will try to review it as soon as possible and release a new version.

simonbrunel commented 3 years ago

Fixed by #14 and released as part of v1.0.2.

BR0kEN- commented 3 years ago
Screenshot 2021-02-28 at 20 16 57

Hurray! Finally! Thanks!

ejosafat commented 3 years ago

thanks!