Skip to content

Commit

Permalink
Changed componentDidCatch no-state-update warning message to remove m…
Browse files Browse the repository at this point in the history
…ention of throw

I think this is confusing because it implies that gDSFE can throw and cDC will still be called, when that is not the case (because cDC is a commit phase lifecycle- and if gDSFE rethrows, the boundary in question will never mount and the commit phase menthods it defines will not be called.
  • Loading branch information
Brian Vaughn committed Sep 28, 2018
1 parent 9943c6c commit 54f637f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2111,8 +2111,7 @@ describe('ReactErrorBoundaries', () => {
);
}).toWarnDev(
'InvalidErrorBoundary: Error boundaries should implement getDerivedStateFromError(). ' +
'In that method, return a state update to display an error message or fallback UI, ' +
'or rethrow the error to let parent components handle it',
'In that method, return a state update to display an error message or fallback UI.',
{withoutStack: true},
);
expect(container.textContent).toBe('');
Expand Down
3 changes: 1 addition & 2 deletions packages/react-reconciler/src/ReactFiberUnwindWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ function createClassErrorUpdate(
warningWithoutStack(
fiber.expirationTime === Sync,
'%s: Error boundaries should implement getDerivedStateFromError(). ' +
'In that method, return a state update to display an error message or fallback UI, ' +
'or rethrow the error to let parent components handle it.',
'In that method, return a state update to display an error message or fallback UI.',
getComponentName(fiber.type) || 'Unknown',
);
}
Expand Down

0 comments on commit 54f637f

Please sign in to comment.