From b605c0048d0e44c1f573466764fe778fa7baf2a7 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Wed, 2 Oct 2019 17:28:03 +0100 Subject: [PATCH] Add an error boundary around the RoomView This adds a more specific boundary around the `RoomView` for room-specific errors and is an example how we could use add boundaries around just a portion of the app. --- src/components/structures/RoomView.js | 135 ++++++++++++++------------ 1 file changed, 73 insertions(+), 62 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 4d52158dae..13523104ae 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -1566,20 +1566,23 @@ module.exports = createReactClass({ const TimelinePanel = sdk.getComponent("structures.TimelinePanel"); const RoomUpgradeWarningBar = sdk.getComponent("rooms.RoomUpgradeWarningBar"); const RoomRecoveryReminder = sdk.getComponent("rooms.RoomRecoveryReminder"); + const ErrorBoundary = sdk.getComponent("elements.ErrorBoundary"); if (!this.state.room) { const loading = this.state.roomLoading || this.state.peekLoading; if (loading) { return (
- + + +
); } else { @@ -1597,18 +1600,20 @@ module.exports = createReactClass({ const roomAlias = this.state.roomAlias; return (
- + + +
); } @@ -1618,12 +1623,14 @@ module.exports = createReactClass({ if (myMembership == 'invite') { if (this.state.joining || this.state.rejecting) { return ( - + + ); } else { const myUserId = MatrixClientPeg.get().credentials.userId; @@ -1638,14 +1645,16 @@ module.exports = createReactClass({ // We have a regular invite for this room. return (
- + + +
); } @@ -1942,41 +1951,43 @@ module.exports = createReactClass({ return (
- - -
- { auxPanel } -
- { topUnreadMessagesBar } - { jumpToBottom } - { messagePanel } - { searchResultsPanel } -
-
-
-
- { statusBar } + + + +
+ {auxPanel} +
+ {topUnreadMessagesBar} + {jumpToBottom} + {messagePanel} + {searchResultsPanel}
+
+
+
+ {statusBar} +
+
+ {previewBar} + {messageComposer}
- { previewBar } - { messageComposer } -
- + +
); },