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

Scatterplot: Tooltip TypeError for empty data #2644

Open
cbix opened this issue Sep 3, 2024 · 0 comments
Open

Scatterplot: Tooltip TypeError for empty data #2644

cbix opened this issue Sep 3, 2024 · 0 comments

Comments

@cbix
Copy link

cbix commented Sep 3, 2024

In general the Scatterplot works really well with TypeScript, however in nivo 0.87.0 the typings for (custom) tooltip seem to be off and may cause a runtime TypeError if the data set is empty, e.g.

TypeError: Cannot read properties of undefined (reading 'data')
    at Tooltip (...)
    [...]

To reproduce:

<ScatterPlot
  width={300}
  height={300}
  data={[{ id: 'data', data: [] }]}
/>

Then hover over the chart.

Expected solutions:

  1. either not render the Tooltip with node === undefined, or
  2. make node optional in tooltip props type and handle the undefined case in the default tooltip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant