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

Popup component does not clean event handlers attached to window when it unmounts #2062

Closed
mkarajohn opened this issue Sep 9, 2017 · 1 comment
Labels

Comments

@mkarajohn
Copy link
Contributor

mkarajohn commented Sep 9, 2017

Steps

  • Have a Popup component with hideOnScroll enabled, inside a view that can get unmounted at any time (for example in the contents of a view which changes its contents based on the selected tab)
  • Hover over the Popup
  • Without scrolling, change the view which the Popup lived (unmount it)
  • Scroll

Expected Result

I would expect the hanlePortalUnmount method of the Popup to remove the hideOnScroll method from the window's scroll event, when the Popup is unmounted. Code

Actual Result

The hideOnScroll is not removed from the window's scroll event, when the Popup is unmounted. As a result when I am in the new view and scroll, the hideOnScroll of the currently unmounted Popup will be executed and try to setState in a currently unmounted component, resulting in this error

warning.js:36 Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the Popup component.

Version

Latest

@mkarajohn
Copy link
Contributor Author

mkarajohn commented Sep 9, 2017

I could try opening a PR for fixing this if you think it's ok

I went ahead and opened a PR

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

No branches or pull requests

2 participants