aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui/Thread.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src/ui/Thread.js')
-rw-r--r--vnext/src/ui/Thread.js9
1 files changed, 7 insertions, 2 deletions
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);