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

getBoundingClientRect is called during react reconciliation on an unmount #1

Open
MarcPorciuncula opened this issue Jan 10, 2017 · 0 comments
Labels

Comments

@MarcPorciuncula
Copy link
Owner

MarcPorciuncula commented Jan 10, 2017

componentWillUnmount() {
  controller.unmount(this.props.id, this.ref.getBoundingClientRect());
}

According to (the React docs)[https://facebook.github.io/react/docs/react-component.html#componentwillunmount], componentWillMount, is called immediately before the root dom node associated with the component is removed from the dom, meaning during reconciliation. If it is called during reconciliation, it's entirely possible that layout changes have already been applied to the dom when the bounding rectangle is measured, resulting in animations based on incorrect positions. Additionally, getBoundingClientRect forces a paint during reconciliation, which could cause major performance issues.

2017-01-10_17-01-22

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

1 participant