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

Catch errors from render methods #10215

Closed
mjomble opened this issue Jul 19, 2017 · 2 comments
Closed

Catch errors from render methods #10215

mjomble opened this issue Jul 19, 2017 · 2 comments

Comments

@mjomble
Copy link
Contributor

mjomble commented Jul 19, 2017

Do you want to request a feature or report a bug?

Feature

What is the current behavior?

If a component's render method throws an error, it leaves React in an inconsistent state.
Subsequent renders attempt to update the inconsistent component and result in errors like "Cannot read property 'getHostNode' of null".

Proposed behavior

React could catch the error from the render method, set an "inconsistent state" flag and re-throw it.
Afterwards, if React is about to update the previously rendered component, but this flag is set, it could discard or unmount the existing component and perform a fresh render, as if the container were empty.

Which versions of React, and which browser / OS are affected by this issue?

I've encountered the inconsistent state problems in 15.5 and 15.6

@maieonbrix
Copy link

It will be done in the next major release of react called fiber.

Here is the requested features as an issue on this repo : #2461

Good read :

https://giamir.com/what-is-react-fiber

@gaearon
Copy link
Collaborator

gaearon commented Jul 19, 2017

Closing as a duplicate of #2461.

@gaearon gaearon marked this as a duplicate of #2461 Jul 19, 2017
@gaearon gaearon closed this as completed Jul 19, 2017
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