Skip to content
New issue

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

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

v3 Calling update in custom tooltip or onHover throws max call stack size exceeded #8737

Closed
sdehm opened this issue Mar 26, 2021 · 4 comments · Fixed by #8738
Closed

v3 Calling update in custom tooltip or onHover throws max call stack size exceeded #8737

sdehm opened this issue Mar 26, 2021 · 4 comments · Fixed by #8738

Comments

@sdehm
Copy link

sdehm commented Mar 26, 2021

Expected Behavior

Calling update in a custom tooltip or onHover function should update the chart without an exception. This was working in v2.

Current Behavior

Calling update causes a maximum call stack size exceeded error after a delay. Occasionally the update does eventually apply.

Possible Solution

Triggering the chart update with an event applies the change immediately but also throws the maximum call stack size exceeded error. Seems like it gets stuck in an infinite loop and overflows.

Steps to Reproduce

This codepen reproduces the error:
https://codepen.io/scdehmlow/pen/QWdNGxG

Context

I know that this codepen example functionality can be replicated with a hoverBorder but I have actual hovering logic that is more complicated that I would like to trigger from tooltip or hover events.

Environment

  • Chart.js version: 3.0.0-rc.5
  • Browser name and version: Chrome 89.0.4389.90
  • Link to your project:
@kurkle
Copy link
Member

kurkle commented Mar 26, 2021

This is the event replaying that is used to track the elements under mouse on update. There should be a way to check if the update is called from the same event and skip the replay.

@kurkle kurkle linked a pull request Mar 27, 2021 that will close this issue
@sdehm
Copy link
Author

sdehm commented Mar 29, 2021

Thanks for working on this so quickly! Unfortunately I am still seeing the issue in the latest release, 3.0.0-rc.6, that includes the fix from #8738. I have updated this codepen to use 3.0.0-rc.6.

@kurkle
Copy link
Member

kurkle commented Mar 29, 2021

You'll need to ignore the event when context.replay is true.
https://codepen.io/kurkle/pen/QWdKKoz

@sdehm
Copy link
Author

sdehm commented Mar 29, 2021

That works, thanks!

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

Successfully merging a pull request may close this issue.

2 participants