Memory leak in SearchBar component #99471
Labels
bug
Fixes for quality problems that affect the customer experience
impact:high
Addressing this issue will have a high level of impact on the quality/strength of our product.
loe:small
Small Level of Effort
performance
SharedUX/fix-it-week
Bugs that have been groomed and queued up for the team's next fix it week
The SearchBar component currently has a severe memory leak. It creates
ResizeObserver
that it connects in it'scomponentDidMount
method, but will never unobserve and disconnect that when the component gets unmounted, thus leading to the now unmounted (no longer used) ResizeObserver keeping around a reference to the DOM object it's watching and causing a potential very large detached DOM tree around. This will cause memory consumption and grow in detached (and not garbage collectable) DOM nodes every time this component unmounts. This is perceivable very well e.g. in Discover when you switch index patterns, which currently rerenders the page (thus unmounts and mount the search bar). Looking at the browsers performance tools you can see how every time the DOM node count and the JS heap will continue growing and never been cleaned up.The text was updated successfully, but these errors were encountered: