From a99518c2b9d155a3e9dafa2f4cb78cacab5be4a6 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 21 Jan 2025 11:49:14 +0100 Subject: [PATCH] chore: use ref for new comment value --- .../src/components/tasks/partials/Comments.vue | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/tasks/partials/Comments.vue b/frontend/src/components/tasks/partials/Comments.vue index 330e81f3b..15a845ec3 100644 --- a/frontend/src/components/tasks/partials/Comments.vue +++ b/frontend/src/components/tasks/partials/Comments.vue @@ -151,7 +151,7 @@
{{ $t('task.comment.comment') }} @@ -241,7 +241,7 @@ const commentToDelete = reactive(new TaskCommentModel()) const isCommentEdit = ref(false) const commentEdit = reactive(new TaskCommentModel()) -const newComment = reactive(new TaskCommentModel()) +const newCommentText = ref('') const saved = ref(null) const saving = ref(null) @@ -292,7 +292,6 @@ async function loadComments(taskId: ITask['id']) { return } - newComment.taskId = taskId commentEdit.taskId = taskId commentToDelete.taskId = taskId comments.value = await taskCommentService.getAll({taskId}, {}, currentPage.value) @@ -317,7 +316,7 @@ const editorActive = ref(true) const creating = ref(false) async function addComment() { - if (newComment.comment === '') { + if (newCommentText.value === '') { return } @@ -331,9 +330,12 @@ async function addComment() { creating.value = true try { + const newComment = new TaskCommentModel() + newComment.taskId = props.taskId + newComment.comment = newCommentText.value const comment = await taskCommentService.create(newComment) comments.value.push(comment) - newComment.comment = '' + newCommentText.value = '' success({message: t('task.comment.addedSuccess')}) } finally { creating.value = false