Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always rethrow original error when we replay errors (facebook#20425)
We replay errors so you can break on paused exceptions. This is done in the second pass so that the first pass can ignore suspense. Originally this threw the original error. For suppression purposes we copied the flag onto the original error. https://github.com/facebook/react/blob/f1dc626b29b8bf0f14c75a8525e8650b7ea94a47/packages/react-reconciler/src/ReactFiberScheduler.old.js#L367-L369 During this refactor it changed to just throw the retried error: facebook#15151 We're not sure exactly why but it was likely just an optimization or clean up. So we can go back to throwing the original error. That helps in the case where a memoized function is naively not rethrowing each time such as in Node's module system. Unfortunately this doesn't fix the problem fully. Because invokeGuardedCallback captures the error and logs it to the browser. So you still end up seeing the wrong message in the logs. This just fixes so that the error boundary sees the first one.
- Loading branch information