diff --git a/e2e/search.spec.ts b/e2e/search.spec.ts index e27aedc92..a08a281dd 100644 --- a/e2e/search.spec.ts +++ b/e2e/search.spec.ts @@ -92,8 +92,12 @@ test("Find in Files streams matches by file and opens the chosen one at its line await dialog.getByRole("textbox", { name: "Text to find" }).fill("OrderService"); const matches = dialog.getByRole("listbox", { name: "Matches" }); await expect(matches.getByRole("option")).toHaveCount(3); + // The TODO index scans the project through `search_start` too, on its own schedule. await expect - .poll(async () => (await ipcCalls(page, "search_start")).at(-1)?.query) + .poll( + async () => + (await ipcCalls(page, "search_start")).filter((c) => !/\bTODO\b/.test(c.query?.pattern ?? "")).at(-1)?.query, + ) .toMatchObject({ pattern: "OrderService", }); diff --git a/src/features/run/store.ts b/src/features/run/store.ts index 9c37216d5..168c45158 100644 --- a/src/features/run/store.ts +++ b/src/features/run/store.ts @@ -530,10 +530,10 @@ function enqueue(sessionId: string, chunk: OutputChunk) { ? { timeout: window.setTimeout(() => flush(sessionId), 100) } : wait > 0 ? { - timeout: window.setTimeout( - () => (rt.flushHandle = { raf: requestAnimationFrame(() => flush(sessionId)) }), - wait, - ), + timeout: window.setTimeout(() => { + if (document.hidden) flush(sessionId); + else rt.flushHandle = { raf: requestAnimationFrame(() => flush(sessionId)) }; + }, wait), } : { raf: requestAnimationFrame(() => flush(sessionId)) }; }