From adf830dfcd1350e104b92a0f088e5664a35b7b15 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 15 Aug 2019 09:56:12 +0300 Subject: jsdoc updates --- vnext/src/ui/Thread.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'vnext/src/ui/Thread.js') diff --git a/vnext/src/ui/Thread.js b/vnext/src/ui/Thread.js index e469b8cf..cbd40c4c 100644 --- a/vnext/src/ui/Thread.js +++ b/vnext/src/ui/Thread.js @@ -16,6 +16,10 @@ import { bubbleStyle, chatItemStyle } from './helpers/BubbleStyle'; import './Thread.css'; let isMounted; +/** + * @type import('../api').Message + */ +const emptyMessage = {}; /** * @param {{ @@ -122,7 +126,8 @@ export default function Thread(props) { const [replies, setReplies] = useState([]); const [loading, setLoading] = useState(false); const [active, setActive] = useState(0); - const [editing, setEditing] = useState({}); + + const [editing, setEditing] = useState(emptyMessage); const [hash, setHash] = useState(props.visitor.hash); const { mid } = props.match.params; @@ -162,7 +167,7 @@ export default function Thread(props) { const { mid, rid, body, attach } = template; let commentAction = editing.rid ? update(mid, editing.rid, body) : comment(mid, rid, body, attach); commentAction.then(res => { - setEditing({}); + setEditing(emptyMessage); loadReplies(); }) .catch(console.log); -- cgit v1.2.3