Fix draft comment stuck (#3072)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-04-25 22:15:52 +06:00 committed by GitHub
parent b259173407
commit 1ce134c292
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,25 +79,30 @@
async function onMessage (event: CustomEvent) {
loading = true
const { message, attachments } = event.detail
await client.addCollection<Doc, Comment>(
_class,
object.space,
object._id,
object._class,
'comments',
{ message, attachments },
_id
)
try {
draftController.remove()
commentInputBox.removeDraft(false)
await client.addCollection<Doc, Comment>(
_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
}
}
</script>