From 411c9ef741b90edeb91ef6d6786e646fca2441ca Mon Sep 17 00:00:00 2001 From: mgt Date: Sun, 29 Sep 2024 23:14:32 +0800 Subject: [PATCH] fix: pending for submit & modify submit is not correctly displayed --- frontend/lib/dom/comment.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/frontend/lib/dom/comment.ts b/frontend/lib/dom/comment.ts index fe4094b1..4a9332c0 100644 --- a/frontend/lib/dom/comment.ts +++ b/frontend/lib/dom/comment.ts @@ -243,7 +243,7 @@ export const submitComment = async ({ pending: true, }); } - + await openCommentsPanel(); const resp = await res; if (!resp.ok) { @@ -263,7 +263,7 @@ export const submitComment = async ({ updateAvailableComments(); }; -export const _modifyComment = async ({ +export const modifyComment = async ({ id, comment, }: { @@ -290,6 +290,7 @@ export const _modifyComment = async ({ ); } + await openCommentsPanel(); const resp = await res; if (!resp.ok) { @@ -714,7 +715,6 @@ export const renderComments = async (comments: Comment[]) => { } notification.textContent = ""; - await openCommentsPanel(); const newSubmitButton = commentsPanel.querySelector( "[data-review-selected] button[data-action='submit']", ) as HTMLButtonElement; @@ -805,10 +805,9 @@ export const renderComments = async (comments: Comment[]) => { case "modify_submit": { const id = container.dataset.modifingId; if (id == undefined) return; - await openCommentsPanel(); try { - await _modifyComment({ + await modifyComment({ id: parseInt(id), comment: textarea.value, });