Skip to content

Triggering suspense with rejected promise causes re-render instead of error boundary #17526

Closed
@jolyndenning

Description

@jolyndenning

Do you want to request a feature or report a bug?

This might be a bug. @gaearon and @sebmarkbage shared differing opinions on it in this twitter thread

What is the current behavior?

If you throw a promise that rejects from a react component's render function, that rejection will be completely ignored. It will not show up in browser console, nor will it trigger a React error boundary. Instead, it will trigger a re-render (the same as if the promise had resolved).

Codepen example

What is the expected behavior?

My expectation was that the error boundary would be hit and the component would not re-render. Sebastian's tweet indicates that that is not the desired behavior, though.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

This impacts react@experimental, and also react@>=16.9.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions