fix: auto-refresh browse results when AI assessments complete

Track aiSt.done across poll cycles; re-fetch current page whenever
the done count increases while on the browse tab.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-13 21:13:35 +02:00
parent f33dabbb7d
commit 793aea8a5f

View File

@@ -535,12 +535,21 @@ function app() {
pipeline: {hot:{count:0,samples:[]},warm:{count:0,samples:[]},cold:{count:0,samples:[]}}, pipeline: {hot:{count:0,samples:[]},warm:{count:0,samples:[]},cold:{count:0,samples:[]}},
toast: {show:false,msg:'',type:'success'}, toast: {show:false,msg:'',type:'success'},
modal: {open:false, domain:'', ai:{}, sa:null}, modal: {open:false, domain:'', ai:{}, sa:null},
_chart: null, _poll: null, _toastTimer: null, _chart: null, _poll: null, _toastTimer: null, _lastAiDone: 0,
async init() { async init() {
await Promise.all([this.loadStats(), this.pollIndex(), this.loadAiStatus()]); await Promise.all([this.loadStats(), this.pollIndex(), this.loadAiStatus()]);
this._poll = setInterval(()=>{ this._lastAiDone = this.aiSt.done ?? 0;
this.loadStats(); this.pollIndex(); this.loadAiStatus(); this._poll = setInterval(async ()=>{
this.loadStats(); this.pollIndex();
await this.loadAiStatus();
// Refresh browse results when new AI assessments complete
if((this.aiSt.done ?? 0) > this._lastAiDone && this.tab==='browse' && this.domains.length>0) {
this._lastAiDone = this.aiSt.done;
await this._fetch();
} else {
this._lastAiDone = this.aiSt.done ?? 0;
}
if(this.tab==='enrich') this.loadQueue(); if(this.tab==='enrich') this.loadQueue();
if(this.tab==='pipeline') this.loadPipeline(); if(this.tab==='pipeline') this.loadPipeline();
}, 3000); }, 3000);