-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
Support passthrough updates for error boundaries #7949
Merged
+1,574
−248
Merged
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
7ebc488
Initial pass at the easy case of updates (updates that start at the r…
jimfb 9017999
Don't expect an extra componentWillUnmount call
gaearon 965d12f
Remove duplicate expectations from the test
gaearon 8236279
Fix style issues
gaearon d09d33f
Make naming consistent throughout the tests
gaearon aedd80d
receiveComponent() does not accept safely argument
gaearon 5f869d2
Assert that lifecycle and refs fire for error message
gaearon 3890a3a
Add more tests for mounting
gaearon 045dcb5
Do not call componentWillMount twice on error boundary
gaearon b69d428
Document more of existing behavior in tests
gaearon e374fc7
Do not call componentWillUnmount() when aborting mounting
gaearon 1fa0b36
Consistently display error messages in tests
gaearon 8066a50
Add more logging to tests and remove redundant one
gaearon b0e6a08
Refactor tests
gaearon 842bd75
Split complicated tests into smaller ones
gaearon 0783dee
Assert clean unmounting
gaearon b36526e
Add assertions about update hooks
gaearon db4c306
Add more tests to document existing behavior and remove irrelevant de…
gaearon 99dad51
Verify we can recover from error state
gaearon de5bdf1
Fix lint
gaearon c64dbfd
Error in boundary’s componentWillMount should propagate up
gaearon 7026adc
Move calling componentWillMount() into mountComponent()
gaearon 9f66fa4
Remove extra whitespace
gaearon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should just move this out of the try/catch so you can avoid the argument bloat and runtime check. It would help with my understanding as well because this one is not recursive where as the componentWillUnmount equivalent flag is recursive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move what out? Yeah I'd like to make this less ambiguous but I don't see what you propose yet.
I want to "retry mounting but without calling the hook". Do you propose to extract everything except calling the hook in another method, and then calling that method specifically from the "retry" path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm suggesting moving the content of this block (calling the life-cycle) to mountComponent (line 335).
This would also move it out of the try/catch in
performInitialMountWithErrorHandling
but I believe that is currently a bug. If an error happens in this life-cycle, then we should propagate the error up to the outer error boundary. Not handle it in this failed one.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooh good catch. (See what I did there?)