Fix update modal hanging indefinitely after completion (related to #628)

When updates complete quickly, the status API may return 'completed' before
the frontend detects the 'restarting' phase. This left users staring at a
frozen modal with no feedback, requiring manual page refresh.

Changes:
- When status is 'completed', immediately check /api/health
- If backend is healthy, reload the page to get new version
- If health check fails, assume restart in progress and start health polling
- Ensures users always get reloaded to the new version automatically

This fixes the UX issue reported in discussion #628 where the update modal
appeared frozen indefinitely despite successful update completion.
This commit is contained in:
rcourtman 2025-11-07 08:11:52 +00:00
parent b5ef239973
commit 5898cb81be

View file

@ -49,6 +49,28 @@ export function UpdateProgressModal(props: UpdateProgressModalProps) {
currentStatus.status === 'idle' ||
currentStatus.status === 'error'
) {
// If completed successfully, verify backend health and reload to get new version
if (currentStatus.status === 'completed' && !currentStatus.error) {
if (pollInterval) {
clearInterval(pollInterval);
}
// Verify backend is healthy and reload
try {
const healthCheck = await fetch('/api/health', { cache: 'no-store' });
if (healthCheck.ok) {
logger.info('Update completed, backend healthy, reloading...');
window.location.reload();
return;
}
} catch (error) {
logger.warn('Update completed but health check failed, assuming restart...', error);
}
// If health check failed, assume restart in progress
setIsRestarting(true);
startHealthCheckPolling();
return;
}
setIsComplete(true);
if (currentStatus.status === 'error' || currentStatus.error) {
setHasError(true);