Skip to content

Commit

Permalink
fix: pending for submit & modify submit is not correctly displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
Enter-tainer committed Sep 29, 2024
1 parent b86ded8 commit 411c9ef
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions frontend/lib/dom/comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export const submitComment = async ({
pending: true,
});
}

await openCommentsPanel();
const resp = await res;

if (!resp.ok) {
Expand All @@ -263,7 +263,7 @@ export const submitComment = async ({
updateAvailableComments();
};

export const _modifyComment = async ({
export const modifyComment = async ({
id,
comment,
}: {
Expand All @@ -290,6 +290,7 @@ export const _modifyComment = async ({
);
}

await openCommentsPanel();
const resp = await res;

if (!resp.ok) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
});
Expand Down

0 comments on commit 411c9ef

Please sign in to comment.