From 4c71861813a4b3d38b5eabc196f95f2f30146f54 Mon Sep 17 00:00:00 2001 From: Qiufeng Date: Sat, 5 Sep 2026 10:08:49 +0800 Subject: [PATCH] fix: prevent duplicate update submissions --- package.json | 2 +- web-next/src/pages/update/UpdatePage.tsx | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 747ca1a..2ecf472 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tallynote", - "version": "1.2.1", + "version": "1.2.2", "private": true, "type": "module", "packageManager": "pnpm@9.0.6", diff --git a/web-next/src/pages/update/UpdatePage.tsx b/web-next/src/pages/update/UpdatePage.tsx index be8bfdb..31731b9 100644 --- a/web-next/src/pages/update/UpdatePage.tsx +++ b/web-next/src/pages/update/UpdatePage.tsx @@ -450,7 +450,8 @@ export default function UpdatePage({ // Start download action const startDownload = async () => { - if (!latest) return; + if (!latest || actionInFlight.current || hasActiveJob || canApply) return; + actionInFlight.current = true; setActionBusy(true); setError(""); setModalError(""); @@ -469,12 +470,14 @@ export default function UpdatePage({ notify?.(msg, "error"); } finally { setActionBusy(false); + actionInFlight.current = false; } }; // Start apply action const startApply = async () => { - if (!latest) return; + if (!latest || !job || job.status !== "staged" || job.operation !== "download" || actionInFlight.current) return; + actionInFlight.current = true; setActionBusy(true); setError(""); setModalError(""); @@ -492,6 +495,7 @@ export default function UpdatePage({ notify?.(msg, "error"); } finally { setActionBusy(false); + actionInFlight.current = false; } };