chartjs / chartjs-plugin-annotation

Annotation plugin for Chart.js
MIT License
607 stars 328 forks source link

State doesn't update the listeners which has been removed at runtime #581

Closed stockiNail closed 2 years ago

stockiNail commented 2 years ago

When you define some event hooks at top level of plugin options, if during the lifecycle you remove it, the state doesn't change the list of listeners and therefore if the event is fired against that hook, the hook is invoked even if the user disabled it.

This happens when you have more than 1 hooks and, after removing some of them, at least one remains in the configuration.

See codepen: https://codepen.io/stockinail/pen/dyVRZzY