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

ReactCompositeComponent.mountComponent needs a try/finally #208

Closed
sophiebits opened this issue Jul 19, 2013 · 1 comment · Fixed by #897
Closed

ReactCompositeComponent.mountComponent needs a try/finally #208

sophiebits opened this issue Jul 19, 2013 · 1 comment · Fixed by #897

Comments

@sophiebits
Copy link
Contributor

Probably it should always set _compositeLifeCycleState to null, or else React gets confused when exceptions are thrown in render (or in mountComponent, etc).

@sophiebits
Copy link
Contributor Author

Made better by a06de4b but not entirely. In particular, the lifecycle state doesn't get changed back which gives you the confusing

Error: Invariant Violation: replaceState(...): Cannot update while unmounting component or during an existing state transition (such as within `render`).

if you make another state update. Anyone have good ideas for what the behavior should be in this case?

sophiebits added a commit to sophiebits/react that referenced this issue Jan 15, 2014
Fixes facebook#208. If you attempt a state update with a bad state then the render will fail (and the DOM won't change) but if you switch back to a valid state later then it'll rerender properly.
petehunt added a commit that referenced this issue Jan 15, 2014
Wrap _performComponentUpdate call in try/finally
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

Successfully merging a pull request may close this issue.

1 participant