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

[charts] Tooltip: 'TypeError: series is undefined' with updating series #15065

Open
alexgavrushenko opened this issue Oct 23, 2024 · 3 comments
Labels
bug 🐛 Something doesn't work component: charts This is the name of the generic UI component, not the React module!

Comments

@alexgavrushenko
Copy link

alexgavrushenko commented Oct 23, 2024

While updating series and changing tooltip state, may encounter a javascript error

TypeError: series is undefined

ChartsItemTooltipContent@webpack-internal:///../node_modules/@mui/x-charts/esm/ChartsTooltip/ChartsItemTooltipContent.js:34:7

May appear while

  1. Moving mouse fast enough
  2. Update series in background

Issue seems to appear because of accessing context by seriesId, that could be removed in the moment of tooltip rendering call
Consider adding undefined check to props of a tooltip, implement a proper GC in SeriesContext or calculate tooltip series outside of its render

Search keywords:

@github-actions github-actions bot added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 23, 2024
@alexfauquette
Copy link
Member

Effectively, that's not a use case we anticipated.

Here is a minimal reproduction from what I understood https://codesandbox.io/embed/8wcxsg?module=/src/Demo.tsx&fontsize=12

The root cause is that the tooltip content comes from the InteractionContext which stores an object identifying the current element you are interacting with (most of the time the seriesId and dataIndex)

This state is maintained up to date by entering/leaving pointer events. But because you remove the series, the state gets outdated.

Checking is the series still exist is a solution. But cleaning the internal state when a series gets removed could be more efficient. Still need to find where to place such logic

@alexfauquette alexfauquette added bug 🐛 Something doesn't work component: charts This is the name of the generic UI component, not the React module! labels Oct 23, 2024
@michelengelen michelengelen changed the title [Charts] Tooltip: 'TypeError: series is undefined' with updating series [charts] Tooltip: 'TypeError: series is undefined' with updating series Oct 23, 2024
@michelengelen michelengelen removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 28, 2024
@michelengelen
Copy link
Member

added this to the board to not lose track of it. 👍🏼

@alexfauquette
Copy link
Member

We will try to solve this issue by checking when a component unmout, itremoves himseft from the interaction context, the same way it does when pointer-out is trigger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: charts This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

3 participants