fix: 修复整合包失败后的完整重试流程
Axolotl desktop CI / guardrails (push) Has been cancelled
Axolotl desktop CI / desktop (macos-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (ubuntu-latest) (push) Has been cancelled
Axolotl desktop CI / desktop (windows-latest) (push) Has been cancelled
Axolotl desktop CI / website (push) Has been cancelled
Repository checks / typos (push) Has been cancelled
Repository checks / tombi (push) Has been cancelled
Rust checks / shear (push) Has been cancelled
Sync source to CNB / Sync Git ref (push) Has been cancelled
Sync LobeHub models / sync (push) Has been cancelled

This commit is contained in:
Disy committed 2026-09-19 00:13:43 +08:00
1 parent 392f01ea4b
commit a47d309103
8 files changed
+266 -32

No files matched your search

@@ -1,6 +1,8 @@
import { ref } from 'vue'
import { invoke } from '@tauri-apps/api/core'
import { hostedCreate, hostedSync } from '../helpers/hosted-packs.ts'
import { ref } from 'vue'
import { hostedCreate } from '../helpers/hosted-packs.ts'
import { runHostedSync } from './useHostedSync.ts'
const installing = ref(false)
const installError = ref('')
@@ -16,6 +18,18 @@ export function forgetHostedCreation(instanceId: string) {
installError.value = ''
}
export function markHostedCreationCompleted(instanceId: string) {
if (createdInstance.value !== instanceId) return
installError.value = ''
completed.value = true
}
export function markHostedCreationFailed(instanceId: string, cause: unknown) {
if (createdInstance.value !== instanceId) return
completed.value = false
installError.value = String(cause)
}
export function useHostedCreation() {
function acknowledge(instanceId: string) {
if (completed.value && createdInstance.value === instanceId) {
@@ -42,12 +56,15 @@ export function useHostedCreation() {
if (completed.value) return createdInstance.value
createdInstance.value ??= await hostedCreate(gameDirRoot)
const instanceId = createdInstance.value
await hostedSync(instanceId)
await runHostedSync(instanceId)
if (attempt !== generation) return
completed.value = true
markHostedCreationCompleted(instanceId)
return instanceId
} catch (cause) {
if (attempt === generation) installError.value = String(cause)
if (attempt === generation) {
if (createdInstance.value) markHostedCreationFailed(createdInstance.value, cause)
else installError.value = String(cause)
}
} finally {
installing.value = false
}