Chart.js
Chart.js copied to clipboard
Fix Bug setting active hover to undefined
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected] for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/chart.js/dist/chart.js b/node_modules/chart.js/dist/chart.js
index e67f0ee..6021286 100644
--- a/node_modules/chart.js/dist/chart.js
+++ b/node_modules/chart.js/dist/chart.js
@@ -1029,6 +1029,7 @@ class DatasetController {
}
}
_setStyle(element, index, mode, active) {
+ if (!element) return;
element.active = active;
const options = this.getStyle(index, active);
this._resolveAnimations(index, mode, active).update(element, {
This issue body was partially generated by patch-package.
Do you also have a reproducible sample of this failing and crashing?
Hi! Thank you for your response. The issue seems to occur occasionally, likely when the chart is being destroyed while the mouse is still hovering over it. Unfortunately, I haven't been able to reproduce it consistently, which makes it challenging to provide a sample.