You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just wanted to look further into this but I'm not sure if I understand exactly: the two additional event listeners (3 and 4) come from the internal ClickListener component and listen for an outside click to close the menu. Each ContextMenu is wrapped inside one of those and since the demo has a nested menu / two levels, there are two ClickListeners. For comparison: if you go to the "Multiple groups" story with only one level, you'll only see one of those event listeners.
I couldn't see any listeners piling up when opening and closing the menu a bunch of times.
What package(s) are you using?
carbon-components
carbon-components-react
Detailed description
Follow up issue from #8099 - in browsers that aren't Safari, the click event listener should be removed in the useEffect cleanup function.
In theory the garbage collector will prevent this (small) leak but it would be best to ensure it's removed when the component is unmounted.
You can see in chrome that multiple event listeners are registered when the ContextMenu is opened a few times.
FYI @janhassel something I missed in review 🙃
Thanks for taking a second look at this with me @andreancardona !
The text was updated successfully, but these errors were encountered: