From: Dessalines <dessalines@users.noreply.github.com>
Date: Thu, 4 Aug 2022 14:28:58 +0000 (-0400)
Subject: Fixing post_view glitch. Fixes #740 (#741)
X-Git-Url: http://these/git/%22https:/join-lemmy.org/static/sneer-club-logo.svg?a=commitdiff_plain;h=b0cfb4fe4a12111755cc54e01f84de08f4b83856;p=lemmy-ui.git

Fixing post_view glitch. Fixes #740 (#741)
---

diff --git a/src/shared/components/post/post.tsx b/src/shared/components/post/post.tsx
index e8b8619..33e0978 100644
--- a/src/shared/components/post/post.tsx
+++ b/src/shared/components/post/post.tsx
@@ -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 => (