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

onClickOutside internal method findDomNode sometimes throws error not able to find the DOM Node. #328

Open
mykas opened this issue Aug 23, 2019 · 4 comments

Comments

@mykas
Copy link

mykas commented Aug 23, 2019

In certain cases this methods throws an error not finding the Dom. It seems it is related to React and it was fixed in react 16.9.0. Dan from React suggests moving away from findDomNode method as it will be deprecated anyway.

https://github.com/Pomax/react-onclickoutside/blob/master/src/index.js#L100
facebook/react#14188 (comment)

@mykas
Copy link
Author

mykas commented Aug 23, 2019

It seems it is related to usage under React.Suspense

@moparlakci
Copy link

moparlakci commented Nov 19, 2019

Same issue here.. Using React.Lazy & Suspense to lazy load some components. While loading/downloading these I show a Loading component. This unmounts all other components I suppose and the setState trigger onClickOutside wouldn't work.

tried the isUnmounted approach but no success

`componentWillUnmount() {
this.isUnmounted = true;
}

handleClickOutside = () => {
if(!this.isUnmounted) {
this.setState({ dropDownOpen: false });
}
} `

Please let me know if anyone have a solution.

@mykas
Copy link
Author

mykas commented Nov 20, 2019

We do have a solution but we will need to do a breaking change version to migrade our clickoutside infrastructure/

@akash-rajput
Copy link

This is blocking us from moving to lazy imports. Please try if your solution solves the issue.

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

3 participants