]> Untitled Git - lemmy-ui.git/commitdiff
Fixing post_view glitch. Fixes #740 (#741)
authorDessalines <dessalines@users.noreply.github.com>
Thu, 4 Aug 2022 14:28:58 +0000 (10:28 -0400)
committerGitHub <noreply@github.com>
Thu, 4 Aug 2022 14:28:58 +0000 (16:28 +0200)
src/shared/components/post/post.tsx

index e8b861921babdf5c90e67f0e1d2d231713f3588e..33e0978e109d49634e34a4292680d62583da6021 100644 (file)
@@ -27,6 +27,7 @@ import {
   SearchResponse,
   SearchType,
   SortType,
+  toOption,
   UserOperation,
   wsJsonToRes,
   wsUserOp,
@@ -569,8 +570,10 @@ export class Post extends Component<any, PostState> {
   }
 
   commentsTree() {
-    let showContextButton =
-      getDepthFromComment(this.state.commentTree[0].comment_view.comment) > 0;
+    let showContextButton = toOption(this.state.commentTree[0]).match({
+      some: comment => getDepthFromComment(comment.comment_view.comment) > 0,
+      none: false,
+    });
 
     return this.state.postRes.match({
       some: res => (