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

Calling onResize callback after the component is unmounted #48

Closed
cecigarcia opened this issue Jun 14, 2018 · 0 comments
Closed

Calling onResize callback after the component is unmounted #48

cecigarcia opened this issue Jun 14, 2018 · 0 comments

Comments

@cecigarcia
Copy link
Contributor

Despite the elementResizeDetector listener is uninstalled before the ContainerDimensions component gets unmounted, I got this warning:

"Warning: Can only update a mounted or mounting component. This usually means you called setState, replaceState, or forceUpdate on an unmounted component. This is a no-op.
Please check the code for the ContainerDimensions component."

I only get this warning in a particular scenario where the ContainerDimensions component is rendered in a tab menu component, but I can't figure out why this case is so particular.

I temporarily fix it by adding an instance variable set to true before the onResize callback is called in componentDidMount lifecycle method, set to false in componentWillUnmount and checked before calling setState in the onResize callback.

I suppose it's not a problem with this library itself but with the element-resize-detector library. I hope you could sort it out anyway.

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

1 participant