Issue 1:
Do you want to request a feature or report a bug?

Bug

What is the current behavior?

In React 15, render errors which killed execution of the app would leave the existing HTML on the page. In React 16, the existing HTML gets wiped (the "white screen of death").

What is the expected behavior?

It would be a much better user experience if we could configure it so the existing HTML remained if render failed. App functionality would fail, but the page would still be there, and users could use standard HTML links etc to continue navigating. In some cases they may not even notice that the app broke.

I'm aware of Error Boundaries as a proposed solution for this in React 16. However, these do not seem like a great solution for us for two reasons:

We'd need to pepper a lot of them across the entire codebase to get reasonable granularity and restrict the impact of errors, for example to a <StickySidebar> on an <Article> or whatever. This is a major code change for an app which might have hundreds of components.

Even if we did the above, we'd get that segment of the app (which may be significant) replaced by an error message. What if there's an unexpected error in <ArticleBody>? That's the entire purpose of the page, replaced by an error message. Far better for us to stop JS execution and leave the user with static HTML.

Obviously, bugs in our app are our fault and we should fix them. But they're not always predictable: for example, today we tracked down a bug to localStorage.setItem throwing an exception only on Safari 10- in Private Browsing mode. That is a tough issue to anticipate. It's difficult to ensure the app is bug-free, and if we miss something, the outcome in React 16 is catastrophic instead of merely a reduction of the user experience.

Here's a demo in React 15: https://codepen.io/giles-v/pen/GdRyBX

Here's the same code in React 16: https://codepen.io/giles-v/pen/xjxYEY

Issue 2:
I wasn't sure where to report this, but this is a problem I'm having with a new feature.

I just finished upgrading my team to React 16. Overall, I think the upgrade is great. We are using fragments and the relaxed constraints on what you can return from render(), and I'm overall very happy with it.

My only issue is with error boundaries. The feature seems to be well-intended, and does help out quite a bit. The improved error reporting especially is beautiful and will make debugging a dream.

The problem is that I believe we are leaving our users in a worse state by having to display fallback UIs. In a perfect world, we would have no client side errors and none of this would even be a discussion. But unfortunately we do have to deal with client-side errors. I agree that leaving the UI in an unpredictable state is less than desired, but I would argue that it's still better than taking away the UI completely. If a user triggers a client-side error, but the UI is still there, they can continue to use the site with little-to-no issue in the case of most errors. But with React 16's new functionality, even the smallest of errors will unmount the UI.

Our options are:

Go with the easy route and implement a top-level error boundary that will unmount the whole UI, replacing it with a fallback that does nothing for the user.

Take significant developer time to implement fine-grained error boundaries that will still leave most of the UI untouched, only replacing components in error. But overall, this will still be taking functionality away from the user.

Either way, with this new functionality, we need to have at least a top-level error boundary to display something to the user. Our top-level boundary still displays our navigation bar so that the user can still navigate away from the page and use other parts of the site. The alternative is that they will need to refresh the page because everything will be unmounted.

I agree that displaying a fallback UI can be useful in instances where you expect an error in some cases (for example, when loading an image from a third party CDN or something). But in cases where a bug is producing an unexpected error, we should still be able to keep the UI in its previous state.

This is how I envision it working:

Error boundaries are still exactly as they are today, except...

If the error was thrown inside the render() of a component, that component will either not be mounted (if it hasn't yet been mounted) or be left in its prior state (if it has already been successfully mounted). The parent of the offending component and all of the parent's other children are still rendered.

If the error was thrown inside a lifecycle method, the offending component's tree is left as it was, and other children of its parent can still be updated.

Error boundaries can still display a fallback UI if they want. componentDidMount() still has the ability to set state.

If you are handling an expected error, you should display a fallback UI. If you are handling an unexpected error, you should try to leave the UI in the most unbroken state possible for the user. The error should still be reported and caught by a top-level error boundary so that it can be logged, but the UI should not need to be replaced in all instances.

Perhaps I'm missing out on a standard process for handling these problems I'm talking about, and I am happy to hear what other people are doing to get around this, but I believe this feature as it exists today means more work for developers, and poor functionality for users.