antoniolago / react-gauge-component

React gauge component for data visualization.
https://antoniolago.github.io/react-gauge-component/
MIT License
132 stars 19 forks source link

fix: Ensure the gauge is re-rendered if it was not displayed before #41

Closed rbedemann closed 5 months ago

rbedemann commented 5 months ago

Referring to https://github.com/antoniolago/react-gauge-component/issues/40

I added a MutationObserver to the element to check if there's a parent container available (which is only the case if the element is not hidden via display: none on itself or one of the parent elements). This ensures that if the element becomes visible again, the re-rendering is being triggered.

It works for my use case, but please give some feedback on performance and if it's also solving other people's problems.

antoniolago commented 5 months ago

Awesome work, thanks for this 🚀