Fix CRITICAL bug: UpdateProgressModal polling never started (fixes #671)

ROOT CAUSE: The onMount hook checked props.isOpen, but onMount only runs ONCE
when the component first mounts. Since UpdateProgressModal mounts when the app
loads (before the user clicks "Apply Update"), props.isOpen is false at mount
time, so polling never initializes.

When the user later clicks "Apply Update" and props.isOpen becomes true, onMount
doesn't re-run, leaving the modal in a broken state with no polling, no restart
detection, and no auto-reload - exactly what users reported (stuck for 30+ mins).

SOLUTION: Changed from onMount to createEffect watching props.isOpen. Now:
- Polling starts immediately when the modal opens (user clicks "Apply Update")
- Polling stops when the modal closes (cleanup)
- The entire update flow works as designed

This was the ACTUAL bug - the previous commits (global watcher, fallback polling)
were helpful additions but didn't fix the root cause.
This commit is contained in:
rcourtman 2025-11-08 23:26:55 +00:00
parent c004c4517f
commit de10ec949e

View file

@ -169,12 +169,20 @@ export function UpdateProgressModal(props: UpdateProgressModalProps) {
}
});
onMount(() => {
// Start/stop polling based on modal visibility
createEffect(() => {
if (props.isOpen) {
// Start polling immediately
// Start polling immediately when modal opens
pollStatus();
// Then poll every 2 seconds
pollInterval = setInterval(pollStatus, 2000) as unknown as number;
} else {
// Stop polling when modal closes
if (pollInterval) {
clearInterval(pollInterval);
pollInterval = undefined;
}
clearHealthCheckTimer();
}
});