This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
Add error boundaries to catch rendering errors #3512
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a basic error boundary around the entire app to catch errors during
rendering and present the user with the options on how to proceed. This is not
implemented as a modal so that it could be used selectively in portions of the
app as well, such as just the
RoomView
.This also adds a more specific boundary around just the
RoomView
for in-room errors. We could consider similar such boundaries around other main content areas in the future.These rendering errors are latent bugs in the app that were previously being hidden by React 15's behaviour of just logging to the console and attempting soldier on anyway. For code hygiene, it does seem best to follow React 16's best practice of stopping (a portion of) the app for such an error so we actually fix it, but we may decide the cost to users is too high. We could change this boundary component then to only log the error to the console and still render children anyway, which effectively be similar to React 15 behaviour.
Fixes element-hq/element-web#11009