tremorlabs / tremor

React components to build charts and dashboards
https://tremor.so
Apache License 2.0
15.39k stars 446 forks source link

[Bug]: BarList `onValueChange` callback fired multiple times #995

Closed BenJenkinson closed 1 month ago

BenJenkinson commented 1 month ago

Tremor Version

3.14.0

Link to minimal reproduction

https://storybook.tremor.so/?path=/story/visualizations-vis-barlist--with-on-value-change

Steps to reproduce

This can actually be reproduced in the storybook example for the BarList onValueChange prop

https://storybook.tremor.so/?path=/story/visualizations-vis-barlist--with-on-value-change

  1. Click the name of a bar
  2. See that you get two alert() dialogs

What is expected?

Clicking any part of the bar (icon, text, or coloured bar area) fires the onValueChange callback once

What is actually happening?

Clicking the "name" on a bar fires the onValueChange callback twice.

What browsers are you seeing the problem on?

Chrome

Any additional comments?

severinlandolt commented 1 month ago

Hi @BenJenkinson and good catch! Looks like it's missing an stopPropagation() for the click event. I will schedule a fix for this in the next release.

If you are in a hurry, I highly recommend to check out an updated version of the BarList here. We just released it over at Tremor Raw, a copy & paste library for React components.

github-actions[bot] commented 1 month ago

:tada: This issue has been resolved in version 3.15.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] commented 1 month ago

:tada: This issue has been resolved in version 3.16.0-beta.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: