From f7ffaf498ddd529d0f20c266748a52eb4842815a Mon Sep 17 00:00:00 2001 From: Stepan Usatiuk Date: Tue, 17 Dec 2019 22:49:25 +0300 Subject: [PATCH] less branching in SharedView --- frontend/src/Documents/SharedView.tsx | 61 +++++++++++++-------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/frontend/src/Documents/SharedView.tsx b/frontend/src/Documents/SharedView.tsx index 92879d0..49c6bd1 100644 --- a/frontend/src/Documents/SharedView.tsx +++ b/frontend/src/Documents/SharedView.tsx @@ -46,39 +46,38 @@ export class SharedViewComponent extends React.PureComponent< } public render() { - if (this.state.loaded) { - if (this.state.error) { - return ( -
-
{this.state.error}
-
- ); - } - const { loggedIn, user } = this.props; - const { doc } = this.state; - if (loggedIn && user.id === doc.user) { - return ; - } - return ( -
-
-
-

{doc.name}

-
-
- -
-
-
- ); - } else { + if (!this.state.loaded) { return ; } + if (this.state.error) { + return ( +
+
{this.state.error}
+
+ ); + } + const { loggedIn, user } = this.props; + const { doc } = this.state; + if (loggedIn && user.id === doc.user) { + return ; + } + return ( +
+
+
+

{doc.name}

+
+
+ +
+
+
+ ); } public async componentDidMount() {