fix(updater): install the already downloaded update instead of fetching it again

This commit is contained in:
wonfen
2026-10-06 14:21:09 +08:00
parent 6ec35c8195
commit c341b9b238
8 changed files with 162 additions and 111 deletions
@@ -15,7 +15,7 @@ import type { Options as ReactMarkdownOptions } from 'react-markdown'
import { BaseDialog, DialogRef } from '@/components/base'
import { useUpdate } from '@/hooks/use-update'
import { restartApp } from '@/services/cmds'
import { installCachedUpdate, restartApp } from '@/services/cmds'
import { showNotice } from '@/services/notice-service'
import { useSetUpdateState, useUpdateState } from '@/services/states'
import { openExternalUrl } from '@/utils/open-external-url'
@@ -270,7 +270,9 @@ export function UpdateViewer({ ref }: { ref?: Ref<DialogRef> }) {
}
try {
await updateInfo.downloadAndInstall(onDownloadEvent)
if (!(await installCachedUpdate(updateInfo.version))) {
await updateInfo.downloadAndInstall(onDownloadEvent)
}
await restartApp()
} catch (err: any) {
showNotice.error(err)