Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated document events when having multiple portal components #66

Closed
oldboyxx opened this issue Apr 25, 2016 · 2 comments
Closed

Duplicated document events when having multiple portal components #66

oldboyxx opened this issue Apr 25, 2016 · 2 comments

Comments

@oldboyxx
Copy link

oldboyxx commented Apr 25, 2016

Try including multiple portals on your page and then put a console log inside 'handleOutsideMouseClick' method. It triggers once for every portal.

So if I have a list of 100 items each wrapped in a portal, the event will trigger 100 times in a row when clicking on one item.

Solution: put addEventListeners inside 'openPortal' and removeEventListeners inside 'closePortal' instead of compDidMount/willUnmount

@tajo
Copy link
Owner

tajo commented Apr 26, 2016

Great idea! Do you want to create a PR?

@oldboyxx
Copy link
Author

False alarm. I made a mistake while fiddling with code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants