fix: persist install progress across page navigation (Task 11)
Marketplace picks up in-progress installs from WebSocket store even if install was started before page was opened. Removed nested .git. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
867e56cb84
commit
1f732d8d08
@ -367,21 +367,38 @@ const installingApps = ref<Map<string, InstallProgress>>(new Map())
|
|||||||
const maxAttempts = ref(60)
|
const maxAttempts = ref(60)
|
||||||
|
|
||||||
// Watch WebSocket data for real install progress from backend
|
// Watch WebSocket data for real install progress from backend
|
||||||
|
// Also picks up installs started before this page was opened (Task 11: persist across nav)
|
||||||
watch(() => store.packages, (packages) => {
|
watch(() => store.packages, (packages) => {
|
||||||
if (!packages) return
|
if (!packages) return
|
||||||
for (const [appId, pkg] of Object.entries(packages)) {
|
for (const [appId, pkg] of Object.entries(packages)) {
|
||||||
const progress = pkg['install-progress']
|
if ((pkg.state as string) === 'installing') {
|
||||||
if (progress && pkg.state === 'installing' && installingApps.value.has(appId)) {
|
const progress = pkg['install-progress']
|
||||||
const current = installingApps.value.get(appId)!
|
// If we don't have a local entry yet, create one from backend state
|
||||||
const pct = progress.size > 0 ? Math.round((progress.downloaded / progress.size) * 100) : 0
|
if (!installingApps.value.has(appId)) {
|
||||||
const downloadedMB = (progress.downloaded / (1024 * 1024)).toFixed(1)
|
installingApps.value.set(appId, {
|
||||||
const totalMB = (progress.size / (1024 * 1024)).toFixed(1)
|
id: appId,
|
||||||
installingApps.value.set(appId, {
|
title: pkg.manifest?.title || appId,
|
||||||
...current,
|
status: 'downloading',
|
||||||
status: 'downloading',
|
progress: 0,
|
||||||
progress: Math.min(pct, 95),
|
message: t('common.installing'),
|
||||||
message: progress.size > 0 ? `Downloading: ${downloadedMB} / ${totalMB} MB (${pct}%)` : t('marketplace.downloading'),
|
attempt: 0,
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
if (progress) {
|
||||||
|
const current = installingApps.value.get(appId)!
|
||||||
|
const pct = progress.size > 0 ? Math.round((progress.downloaded / progress.size) * 100) : 0
|
||||||
|
const downloadedMB = (progress.downloaded / (1024 * 1024)).toFixed(1)
|
||||||
|
const totalMB = (progress.size / (1024 * 1024)).toFixed(1)
|
||||||
|
installingApps.value.set(appId, {
|
||||||
|
...current,
|
||||||
|
status: 'downloading',
|
||||||
|
progress: Math.min(pct, 95),
|
||||||
|
message: progress.size > 0 ? `Downloading: ${downloadedMB} / ${totalMB} MB (${pct}%)` : t('marketplace.downloading'),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if (installingApps.value.has(appId) && (pkg.state as string) !== 'installing') {
|
||||||
|
// Install finished — remove from tracking
|
||||||
|
installingApps.value.delete(appId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, { deep: true })
|
}, { deep: true })
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user