From e31090c9bd2ac2c1a411026add0a3e36631cf8cd Mon Sep 17 00:00:00 2001
From: Dessalines <tyhou13@gmx.com>
Date: Mon, 20 Jan 2020 10:11:50 -0500
Subject: Adding comment and post vote loading indicators. Fixes #449

---
 ui/src/components/post.tsx | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'ui/src/components/post.tsx')

diff --git a/ui/src/components/post.tsx b/ui/src/components/post.tsx
index c4bfccee..2005cc17 100644
--- a/ui/src/components/post.tsx
+++ b/ui/src/components/post.tsx
@@ -400,7 +400,11 @@ export class Post extends Component<any, PostState> {
       found.score = res.comment.score;
       found.upvotes = res.comment.upvotes;
       found.downvotes = res.comment.downvotes;
-      if (res.comment.my_vote !== null) found.my_vote = res.comment.my_vote;
+      if (res.comment.my_vote !== null) {
+        found.my_vote = res.comment.my_vote;
+        found.upvoteLoading = false;
+        found.downvoteLoading = false;
+      }
       this.setState(this.state);
     } else if (op == UserOperation.CreatePostLike) {
       let res: CreatePostLikeResponse = msg;
@@ -408,6 +412,8 @@ export class Post extends Component<any, PostState> {
       this.state.post.score = res.post.score;
       this.state.post.upvotes = res.post.upvotes;
       this.state.post.downvotes = res.post.downvotes;
+      this.state.post.upvoteLoading = false;
+      this.state.post.downvoteLoading = false;
       this.setState(this.state);
     } else if (op == UserOperation.EditPost) {
       let res: PostResponse = msg;
-- 
cgit v1.2.3

