Skip to content
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

Always rethrow original error when we replay errors #20425

Merged
merged 1 commit into from
Dec 10, 2020

Commits on Dec 10, 2020

  1. Always rethrow original error when we replay errors

    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.
    sebmarkbage committed Dec 10, 2020
    Configuration menu
    Copy the full SHA
    751e6d6 View commit details
    Browse the repository at this point in the history