fix: Beállítások endless-refresh loop after a migration (v0.68.3)

The migration journal keeps returning the last completed job; the resume-view
watched any job and migWatch's done-branch reloads the page -> endless reload
loop after any migration. Resume-view now watches only in-progress jobs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-15 21:43:00 +02:00
parent 37ed7570ca
commit a821a9d7d0
2 changed files with 21 additions and 2 deletions
@@ -390,8 +390,12 @@ function pollUntilBack() {
.then(function(r){return r.json();}).then(function(d){ if(d.ok){ migWatch(); } else { alert('Hiba: '+(d.error||'ismeretlen')); } })
.catch(function(e){ alert('Hiba: '+e); });
}
// Resume view: if a migration is already running when the page loads, show the panel.
(function(){ fetch('/api/storage/migrate/status').then(function(r){return r.json();}).then(function(d){ if(d.data&&d.data.job){ migWatch(); } }).catch(function(){}); })();
// Resume view: if a migration is STILL IN PROGRESS when the page loads, show the panel and watch.
// Must NOT re-watch a terminal (done/aborted) job: the journal keeps returning the last completed
// job indefinitely, and migWatch's done-branch reloads the page — so watching a persisted 'done'
// job on every load creates an endless refresh loop. Only the active watcher (started from
// storageMigrateAll) should fire the one-time post-completion reload.
(function(){ fetch('/api/storage/migrate/status').then(function(r){return r.json();}).then(function(d){ var job=d.data&&d.data.job; if(job && job.phase!=='done' && job.phase!=='aborted'){ migWatch(); } }).catch(function(){}); })();
</script>
{{else}}
<div class="empty-state" style="padding:1.5rem">