fix(appstore): резервный REST-опрос прогресса установки (не зависать при потере WS)
All checks were successful
Deploy to Production / Trigger production update (push) Successful in 8s

Мастер установки получал прогресс только по WebSocket; при потерянном
событии (или долгом docker compose up с тяжёлыми образами) UI замирал на
последнем шаге. Добавлен поллинг /operations раз в 3с как фолбэк.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
markmorado
2026-07-08 00:50:31 +05:00
parent 06c4ec8e94
commit e497ae541f
4 changed files with 19 additions and 3 deletions

View File

@@ -73,11 +73,13 @@ export function useInstalledApp(id: number) {
});
}
export function useAppOperations(id: number) {
export function useAppOperations(id: number, pollMs?: number) {
return useQuery({
queryKey: appstoreKeys.operations(id),
queryFn: () => apiClient.get<{ items: AppOperation[] }>(`/api/appstore/apps/${id}/operations`).then((r) => r.items),
enabled: id > 0,
// Резервный опрос (когда задан) — прогресс не зависит только от WebSocket.
refetchInterval: pollMs && pollMs > 0 ? pollMs : false,
});
}