perf: yield to event loop before heavy SQLite query

Adds a setTimeout(0) before parseBubbles so Ink can render
the Loading state before the synchronous query blocks.
This commit is contained in:
AgentSeal 2026-04-15 04:01:17 -07:00
parent b7b7b2c7d6
commit 5ead1e9c07

View file

@ -179,6 +179,8 @@ function createParser(source: SessionSource, seenKeys: Set<string>): SessionPars
&& dbSize >= cache.dbSizeBytes
const afterTimestamp = cacheValid ? cache.lastCreatedAt : undefined
await new Promise(r => setTimeout(r, 0))
const { calls, maxCreatedAt } = parseBubbles(db, seenKeys, afterTimestamp)
if (maxCreatedAt > 0) {