fix(SearchLocal): improve database progress tracking and UI phase advancement

This commit is contained in:
Jaime Idolpx 2026-06-14 21:29:38 -04:00
parent eb0357253c
commit b0c37694ba

View File

@ -233,8 +233,13 @@ export default function SearchLocal({ config, setConfig, onClose, onOpenFolder }
setEngineProgress({ received: 0, total: null });
setDatabaseProgress({ received: 0, total: null });
await openLocateDb(p => flushSync(() => {
if (p.kind === 'engine') setEngineProgress({ received: p.received, total: p.total });
else setDatabaseProgress({ received: p.received, total: p.total });
if (p.kind === 'engine') {
setEngineProgress({ received: p.received, total: p.total });
} else {
// First database chunk arrives → engine phase is done, advance UI.
setDatabaseProgress({ received: p.received, total: p.total });
setDbPhase(phase => phase === 'engine' ? 'downloading' : phase);
}
}));
setDbPhase('ready');
}