iTwin / iTwinUI

A design system for building beautiful and well-working web interfaces.
https://itwin.github.io/iTwinUI/
MIT License
92 stars 35 forks source link

skip unnecessary calculations when `Tooltip` is not visible #2004

Closed mayank99 closed 2 weeks ago

mayank99 commented 2 weeks ago

Changes

Fixes #2002, mainly by removing the autoUpdate function which was being executed even when the tooltip is closed. I also removed floatingStyles when the tooltip is closed, and memoized the middleware object to avoid recreating it on each re-render.

Testing

Manually tested that the performance issue is fixed, with 6x CPU slowdown in Chrome devtools.

Before https://github.com/iTwin/iTwinUI/assets/9084735/34c602bd-4197-467a-939f-d8a62b918b83
After https://github.com/iTwin/iTwinUI/assets/9084735/77b9f38e-b179-4094-830e-57486e30c3b1

Docs

Added changeset.