Skip to content

Fix Bug setting active hover to undefined #12042

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No 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? No Sign in to your account

Open
gleb-28 opened this issue Mar 11, 2025 · 2 comments
Open

Fix Bug setting active hover to undefined #12042

gleb-28 opened this issue Mar 11, 2025 · 2 comments

Comments

@gleb-28
Copy link

gleb-28 commented Mar 11, 2025

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch chart.js@4.4.8 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.

@LeeLenaleee
Copy link
Collaborator

Do you also have a reproducible sample of this failing and crashing?

@gleb-28
Copy link
Author

gleb-28 commented Mar 18, 2025

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.

No Sign up for free to join this conversation on GitHub. Already have an account? No Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants