From 5ead1e9c07dbcc850603e1d1fb27e4eda473a424 Mon Sep 17 00:00:00 2001 From: AgentSeal Date: Wed, 15 Apr 2026 04:01:17 -0700 Subject: [PATCH] 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. --- src/providers/cursor.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/providers/cursor.ts b/src/providers/cursor.ts index 4a980d60..31e1f748 100644 --- a/src/providers/cursor.ts +++ b/src/providers/cursor.ts @@ -179,6 +179,8 @@ function createParser(source: SessionSource, seenKeys: Set): 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) {