diff options
| author | TrainDoctor <traindoctor@protonmail.com> | 2022-08-23 15:23:23 -0700 |
|---|---|---|
| committer | TrainDoctor <traindoctor@protonmail.com> | 2022-08-23 15:23:23 -0700 |
| commit | de1c89af21dff08cf75135228e745bd2e4b1df6d (patch) | |
| tree | 89f29139de7cf66dcee5b88060f31f75578cb2cc /frontend/src/components | |
| parent | 8b3f569a09db9daf7748426f916a66591159928f (diff) | |
| download | decky-loader-de1c89af21dff08cf75135228e745bd2e4b1df6d.tar.gz decky-loader-de1c89af21dff08cf75135228e745bd2e4b1df6d.zip | |
Fix updater being corrupted by multiple attempts to download
Diffstat (limited to 'frontend/src/components')
| -rw-r--r-- | frontend/src/components/DeckyState.tsx | 8 | ||||
| -rw-r--r-- | frontend/src/components/settings/pages/general/Updater.tsx | 6 |
2 files changed, 13 insertions, 1 deletions
diff --git a/frontend/src/components/DeckyState.tsx b/frontend/src/components/DeckyState.tsx index 6f13a007..739da0e1 100644 --- a/frontend/src/components/DeckyState.tsx +++ b/frontend/src/components/DeckyState.tsx @@ -8,6 +8,7 @@ interface PublicDeckyState { activePlugin: Plugin | null; updates: PluginUpdateMapping | null; hasLoaderUpdate?: boolean; + isLoaderUpdating: boolean; } export class DeckyState { @@ -15,6 +16,7 @@ export class DeckyState { private _activePlugin: Plugin | null = null; private _updates: PluginUpdateMapping | null = null; private _hasLoaderUpdate: boolean = false; + private _isLoaderUpdating: boolean = false; public eventBus = new EventTarget(); @@ -24,6 +26,7 @@ export class DeckyState { activePlugin: this._activePlugin, updates: this._updates, hasLoaderUpdate: this._hasLoaderUpdate, + isLoaderUpdating: this._isLoaderUpdating, }; } @@ -52,6 +55,11 @@ export class DeckyState { this.notifyUpdate(); } + setIsLoaderUpdating(isUpdating: boolean) { + this._isLoaderUpdating = isUpdating; + this.notifyUpdate(); + } + private notifyUpdate() { this.eventBus.dispatchEvent(new Event('update')); } 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(); }, }; |
