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:
parent
b5ef239973
commit
5898cb81be
1 changed files with 22 additions and 0 deletions
|
|
@ -49,6 +49,28 @@ export function UpdateProgressModal(props: UpdateProgressModalProps) {
|
||||||
currentStatus.status === 'idle' ||
|
currentStatus.status === 'idle' ||
|
||||||
currentStatus.status === 'error'
|
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);
|
setIsComplete(true);
|
||||||
if (currentStatus.status === 'error' || currentStatus.error) {
|
if (currentStatus.status === 'error' || currentStatus.error) {
|
||||||
setHasError(true);
|
setHasError(true);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue