Open GuiCodron opened 1 year ago
💖 Thanks for opening this pull request! 💖
Here is a list of things that will help get it across the finish line:
yarn lint
locally to catch formatting errors. This will fix some errors automatically, commit and push any changes.yarn test
locally to catch errors. This ensures all components still behave as they should.yarn start
to run the doc site locally and try a few pages, ensuring everything is in good working order.We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.
contentRef is passed to EventStack to subscribe for mouse events. Passing a
contentRef
created usingReact.createRef()
does not allow EventStack to keep track of contentRef changes (since onlycontentRef.current
changes). Ultimately when PortalInner unmountcontentRef.current
is set to undefined and EventStackunsubscribe
handlers withundefined
as a target instead of unsubscribing with real content. This leads to the event-stack Map keeping a reference to the real content thus leaking all dom tree related to the contentRef node.Putting contentRef in the state and passing the element directly to EventStack allow for EventStack to detect change in its props and execute the componentDidUpdate routine which unsubscribe from the previous element on unmount.