Allow supplying an error catcher component #63
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the first cut for error catching facilities in
react-proxy
.This works on classic and class components, without breaking any existing tests.
Because the error component is optional, most of the tested code paths don't actually touch the new code. I wasn't sure how many tests to expand to cover this, so I figured I'd show what I have so far.
As this is a nice incremental change, I think it's useful to aim to merge this without pure component support initially - that might require more invasion changes.
For pure components, I think that https://github.com/gaearon/react-proxy/blob/c019762362a4936ed86d6bb89ad6a57e13de6c06/src/createClassProxy.js#L65-67 might have to change to use detection (like with
react-proxy/src/createClassProxy.js
Line 104 in c019762
One thing I did wonder about just now - what happens if you attempt to replace a component defined with one approach, with a component defined using a different approach?