diff --git a/src/lib/components/Apps/components/Comments/index.svelte b/src/lib/components/Apps/components/Comments/index.svelte index 8f63f542..c6fd3b60 100644 --- a/src/lib/components/Apps/components/Comments/index.svelte +++ b/src/lib/components/Apps/components/Comments/index.svelte @@ -24,6 +24,7 @@ let lessonCommentChannel: RealtimeChannel; let comments: LessonComment[] = []; let groupmember: GroupPerson | undefined; + let isSaving: boolean = false; interface FetchComments { comment: string; @@ -52,14 +53,21 @@ commentAt: new Date().getTime().toLocaleString() } ]; - comment = ''; scrollToBottom(); - await supabase.from('lesson_comment').insert({ - lesson_id: $lesson.id, - groupmember_id: groupmember.id, - comment - }); + isSaving = true; + supabase + .from('lesson_comment') + .insert({ + lesson_id: $lesson.id, + groupmember_id: groupmember.id, + comment + }) + .then(() => { + isSaving = false; + }); + + comment = ''; } function handleKeyDown(e: KeyboardEvent) { @@ -186,7 +194,7 @@ -