diff --git a/plugins/chunter-resources/src/components/CommentInput.svelte b/plugins/chunter-resources/src/components/CommentInput.svelte index f0cfab8044..eeb0846831 100644 --- a/plugins/chunter-resources/src/components/CommentInput.svelte +++ b/plugins/chunter-resources/src/components/CommentInput.svelte @@ -79,25 +79,30 @@ async function onMessage (event: CustomEvent) { loading = true const { message, attachments } = event.detail - await client.addCollection( - _class, - object.space, - object._id, - object._class, - 'comments', - { message, attachments }, - _id - ) + try { + draftController.remove() + commentInputBox.removeDraft(false) + await client.addCollection( + _class, + object.space, + object._id, + object._class, + 'comments', + { message, attachments }, + _id + ) - // Create an backlink to document - await createBacklinks(client, object._id, object._class, _id, message) + // Create an backlink to document + await createBacklinks(client, object._id, object._class, _id, message) - // Remove draft from Local Storage - _id = generateId() - comment = getDefault() - draftController.remove() - commentInputBox.removeDraft(false) - loading = false + // Remove draft from Local Storage + _id = generateId() + comment = getDefault() + } catch (err) { + console.error(err) + } finally { + loading = false + } }