From 57a09cd3c65f0e982e5eae8ab0dd4010695898a0 Mon Sep 17 00:00:00 2001 From: jessop Date: Tue, 29 Sep 2020 20:11:48 -0400 Subject: [PATCH] only clear comment text if confirmed --- ui/component/commentCreate/view.jsx | 17 +++++++++-------- ui/redux/actions/comments.js | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ui/component/commentCreate/view.jsx b/ui/component/commentCreate/view.jsx index 1fe5fc5bb..da5af7864 100644 --- a/ui/component/commentCreate/view.jsx +++ b/ui/component/commentCreate/view.jsx @@ -14,7 +14,7 @@ import { useHistory } from 'react-router'; type Props = { uri: string, claim: StreamClaim, - createComment: (string, string, string, ?string) => void, + createComment: (string, string, string, ?string) => Promise, channels: ?Array, topLevelId?: string, onDoneReplying?: () => void, @@ -61,13 +61,14 @@ export function CommentCreate(props: Props) { function handleSubmit() { if (channel !== CHANNEL_NEW && commentValue.length) { - createComment(commentValue, claimId, channel, topLevelId); - } - - setCommentValue(''); - - if (onDoneReplying) { - onDoneReplying(); + createComment(commentValue, claimId, channel, topLevelId).then(res => { + if (res && res.signature) { + setCommentValue(''); + if (onDoneReplying) { + onDoneReplying(); + } + } + }); } } diff --git a/ui/redux/actions/comments.js b/ui/redux/actions/comments.js index d3c163e1d..62d344acb 100644 --- a/ui/redux/actions/comments.js +++ b/ui/redux/actions/comments.js @@ -209,6 +209,7 @@ export function doCommentCreate( claimId: claim_id, }, }); + return result; }) .catch(error => { dispatch({