From 088b2c5fd91a763dbced74111e337a06ce022645 Mon Sep 17 00:00:00 2001 From: lawvs <18554747+lawvs@users.noreply.github.com> Date: Tue, 21 Oct 2025 23:57:31 +0800 Subject: [PATCH] fix: improve toast loading behavior --- .../src/modules/ai-task/components/task-item.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/desktop/layer/renderer/src/modules/ai-task/components/task-item.tsx b/apps/desktop/layer/renderer/src/modules/ai-task/components/task-item.tsx index 01d90816a..104e39009 100644 --- a/apps/desktop/layer/renderer/src/modules/ai-task/components/task-item.tsx +++ b/apps/desktop/layer/renderer/src/modules/ai-task/components/task-item.tsx @@ -173,15 +173,17 @@ export const TaskItem = memo(({ task }: { task: AITask }) => { { icon: "i-mgc-test-tube-cute-re", onClick: async () => { + const loadingId = toast.loading(t("tasks.toast.test_start")) try { - const loadingId = toast.loading(t("tasks.toast.test_start")) await testRunMutation.mutateAsync({ id: task.id }) toast.success(t("tasks.toast.test_success"), { id: loadingId, }) } catch (error) { console.error("Failed to run test:", error) - toast.error(t("tasks.toast.test_failed")) + toast.error(t("tasks.toast.test_failed"), { + id: loadingId, + }) } }, title: t("tasks.actions.test_run"), @@ -220,11 +222,11 @@ export const TaskItem = memo(({ task }: { task: AITask }) => { ] return ( -
+
{t("tasks.fields.schedule")}{" "} {formatScheduleText(task.schedule, t, i18n)}
{task.createdAt && ( -+
{t("tasks.fields.created")}{" "} {dayjs(task.createdAt).format("MMM D, YYYY h:mm A")}