From de1c89af21dff08cf75135228e745bd2e4b1df6d Mon Sep 17 00:00:00 2001
From: TrainDoctor <traindoctor@protonmail.com>
Date: Tue, 23 Aug 2022 15:23:23 -0700
Subject: Fix updater being corrupted by multiple attempts to download

---
 frontend/src/components/settings/pages/general/Updater.tsx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'frontend/src/components/settings/pages/general/Updater.tsx')

diff --git a/frontend/src/components/settings/pages/general/Updater.tsx b/frontend/src/components/settings/pages/general/Updater.tsx
index 3d137d7a..4906c435 100644
--- a/frontend/src/components/settings/pages/general/Updater.tsx
+++ b/frontend/src/components/settings/pages/general/Updater.tsx
@@ -9,6 +9,8 @@ export default function UpdaterSettings() {
   const [updateProgress, setUpdateProgress] = useState<number>(-1);
   const [reloading, setReloading] = useState<boolean>(false);
   const [checkingForUpdates, setCheckingForUpdates] = useState<boolean>(false);
+  const [loaderUpdating, setLoaderUpdating] = useState<boolean>(false);
+
   useEffect(() => {
     (async () => {
       const res = (await callUpdaterMethod('get_version')) as { result: VerInfo };
@@ -36,7 +38,7 @@ export default function UpdaterSettings() {
     >
       {updateProgress == -1 ? (
         <DialogButton
-          disabled={!versionInfo?.updatable || checkingForUpdates}
+          disabled={!versionInfo?.updatable || checkingForUpdates || loaderUpdating}
           onClick={
             !versionInfo?.remote || versionInfo?.remote?.tag_name == versionInfo?.current
               ? async () => {
@@ -49,10 +51,12 @@ export default function UpdaterSettings() {
                   window.DeckyUpdater = {
                     updateProgress: (i) => {
                       setUpdateProgress(i);
+                      setLoaderUpdating(true);
                     },
                     finish: async () => {
                       setUpdateProgress(0);
                       setReloading(true);
+                      setLoaderUpdating(false);
                       await finishUpdate();
                     },
                   };
-- 
cgit v1.2.3

