Skip to content

Prevent an infinite loop in browsers when an error happens in resolve #60

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

Merged
merged 1 commit into from
Oct 11, 2017

Conversation

xzyfer
Copy link
Contributor

@xzyfer xzyfer commented Oct 10, 2017

Whenever an error occurs resolving a component this.state.error = true,
however handling the error happens too late. As a result in an environment
where typeof window !== 'undefined' i.e. the browser, this results in an
infinite render loop.

This PR hoists the error handling earlier in the render call.

Fixes #42

Whenever an error occurs resolving a component `this.state.error = true`,
however handling the error happens too late. As a result in an environment
where `typeof window !== 'undefined'` i.e. the browser, this results in an
infinite `render` loop.

This PR hoists the error handling earlier in the `render` call.

Fixes ctrlplusb#42
@ctrlplusb
Copy link
Owner

Really excellent stuff here @xzyfer! Thanks so much for this.

I am gonna try pull it down and have a play but so far it LGTM.

❤️

@jfsiii
Copy link

jfsiii commented Oct 10, 2017

Confirming that this work for me

@ctrlplusb ctrlplusb merged commit 3216f71 into ctrlplusb:master Oct 11, 2017
@xzyfer xzyfer deleted the infinite-loop branch October 11, 2017 23:49
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 this pull request may close these issues.

3 participants