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

findDOMNode was called on an unmounted component. #7

Closed
ghost opened this issue Jul 18, 2016 · 3 comments
Closed

findDOMNode was called on an unmounted component. #7

ghost opened this issue Jul 18, 2016 · 3 comments

Comments

@ghost
Copy link

ghost commented Jul 18, 2016

Due to debounce mechanism (function buffer), the forceAlign method may be triggered even after component was removed from DOM tree. This will result in findDOMNode was called on an unmounted component error.

The easy fix is to check if component is mounted, something like

forceAlign() {
    const props = this.props;
    if (!props.disabled && ReactDOM.isMounted(this)) {
        const source = ReactDOM.findDOMNode(this);
        props.onAlign(source, align(source, props.target(), props.align));
    }
},

but since isMounted method is deprecated, this isn't probably a best solution

@Tlapi
Copy link

Tlapi commented Jul 18, 2016

+1

@Tlapi
Copy link

Tlapi commented Jul 22, 2016

@yiminghe What do you think?

@yiminghe
Copy link
Member

thanks.

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