From d58d2b7b29700f5175e191d068def53d4c9ebe2c Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Wed, 25 Jan 2023 10:12:26 +0700 Subject: [PATCH] Show progress while gpt do calculations (#2538) Signed-off-by: Andrey Sobolev --- .../src/components/ReferenceInput.svelte | 15 +++++-- .../src/components/AttachmentRefInput.svelte | 3 ++ .../src/components/CommentInput.svelte | 42 +++++++++++-------- .../activity/TxCommentCreate.svelte | 38 ++++++++++------- 4 files changed, 62 insertions(+), 36 deletions(-) diff --git a/packages/text-editor/src/components/ReferenceInput.svelte b/packages/text-editor/src/components/ReferenceInput.svelte index 7bd451eb83..c277897130 100644 --- a/packages/text-editor/src/components/ReferenceInput.svelte +++ b/packages/text-editor/src/components/ReferenceInput.svelte @@ -15,7 +15,7 @@ @@ -140,4 +147,5 @@ {shouldSaveDraft} on:message={onMessage} on:update={onUpdate} + {loading} /> diff --git a/plugins/chunter-resources/src/components/activity/TxCommentCreate.svelte b/plugins/chunter-resources/src/components/activity/TxCommentCreate.svelte index a1f37cfd0b..a54eaa151a 100644 --- a/plugins/chunter-resources/src/components/activity/TxCommentCreate.svelte +++ b/plugins/chunter-resources/src/components/activity/TxCommentCreate.svelte @@ -33,30 +33,36 @@ const editing = false async function onMessage (event: CustomEvent>) { - const { message, attachments } = event.detail - await client.updateCollection( - tx.objectClass, - tx.objectSpace, - tx.objectId, - value.attachedTo, - value.attachedToClass, - value.collection, - { - message, - attachments - } - ) - // We need to update backlinks before and after. - await updateBacklinks(client, value.attachedTo, value.attachedToClass, value._id, message) - + loading = true + try { + const { message, attachments } = event.detail + await client.updateCollection( + tx.objectClass, + tx.objectSpace, + tx.objectId, + value.attachedTo, + value.attachedToClass, + value.collection, + { + message, + attachments + } + ) + // We need to update backlinks before and after. + await updateBacklinks(client, value.attachedTo, value.attachedToClass, value._id, message) + } finally { + loading = false + } dispatch('close', false) } let refInput: AttachmentRefInput + let loading = false
{#if edit}