fix(lens): keep actor paging behind content refresh

This commit is contained in:
moe-berri 2026-10-06 15:10:56 -07:00
commit 57e1dd060f
2 changed files with 5 additions and 1 deletions

View file

@ -217,6 +217,7 @@ describe("TraceConversation", () => {
it("keeps refresh busy until content finishes when live updates pause", async () => {
const user = userEvent.setup();
const pending = Promise.withResolvers<SpanDetail>();
vi.mocked(agentTraceCall).mockResolvedValue({ ...trace, next_cursor: "next-page" });
renderWithProviders(
<RoutedRunView traceId={trace.summary.trace_id} accessToken="test" onBack={vi.fn()} embedded />,
);
@ -229,11 +230,14 @@ describe("TraceConversation", () => {
await user.click(refresh);
await waitFor(() => expect(testQueryClient.isFetching({ queryKey: ["agentTrace"] })).toBe(0));
expect(refresh).toBeDisabled();
const more = screen.getByRole("button", { name: "Load next 20 entries" });
expect(more).toBeDisabled();
await user.click(refresh);
await user.click(screen.getByRole("button", { name: "Live updates" }));
await act(async () => pending.resolve({ ...rootDetail, output: "Updated final answer" }));
expect(await screen.findByText("Updated final answer")).toBeVisible();
await waitFor(() => expect(refresh).toBeEnabled());
expect(more).toBeEnabled();
expect(agentTraceCall).toHaveBeenCalledTimes(2);
});

View file

@ -216,7 +216,7 @@ function LoadedRun({
embedded={embedded}
stale={switching}
conversationPaging={{
loading: traceQuery.isFetching,
loading: manualRead || traceQuery.isFetching,
failed: isFetchNextPageError,
loadMore: fetchNextPage,
}}