From b79c990ee57a25b54ff937e6c8e79d885fbb22d3 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Thu, 13 Jul 2017 22:30:10 +0700 Subject: [PATCH] Only setState once --- client/coral-plugin-commentbox/CommentBox.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/client/coral-plugin-commentbox/CommentBox.js b/client/coral-plugin-commentbox/CommentBox.js index 6e17b119f..084e67fc4 100644 --- a/client/coral-plugin-commentbox/CommentBox.js +++ b/client/coral-plugin-commentbox/CommentBox.js @@ -67,7 +67,7 @@ class CommentBox extends React.Component { postComment(comment, 'comments') .then(({data}) => { - this.setState({loadingState: 'success'}); + this.setState({loadingState: 'success', body: ''}); const postedComment = data.createComment.comment; // Execute postSubmit Hooks @@ -78,8 +78,6 @@ class CommentBox extends React.Component { if (commentPostedHandler) { commentPostedHandler(); } - - this.setState({body: ''}); }) .catch((err) => { this.setState({loadingState: 'error'});