Skip to content

Commit fe5fef5

Browse files
committed
perf: reduce history content paint polling from 120 to 30 RAF attempts
The history overlay polling calls isTurnTextRenderedInViewport() up to 120 times (nearly 2 seconds). Reduced to 30 attempts (~500ms) which is still sufficient for typical content paint latency.
1 parent 414da7e commit fe5fef5

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/web-ui/src/flow_chat/components/modern/ModernFlowChatContainer.history-state.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,15 +578,15 @@ describe('ModernFlowChatContainer historical empty state', () => {
578578
root.render(<ModernFlowChatContainer />);
579579
});
580580

581-
for (let index = 0; index < 120; index += 1) {
581+
for (let index = 0; index < 30; index += 1) {
582582
flushAnimationFrame();
583583
}
584584

585585
expect(container.textContent).not.toContain('Loading saved session');
586586
expect(releaseSpy).not.toHaveBeenCalled();
587587
expect(startupTraceMock.markPhase).toHaveBeenCalledWith(
588588
'historical_session_initial_content_paint_signal_missed',
589-
expect.objectContaining({ attempts: 120 }),
589+
expect.objectContaining({ attempts: 30 }),
590590
);
591591

592592
releaseSpy.mockRestore();

src/web-ui/src/flow_chat/components/modern/ModernFlowChatContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ type BackgroundCommandSummary = {
8989
};
9090

9191
const LATEST_TURN_AUTO_PIN_MAX_ATTEMPTS = 8;
92-
const HISTORY_INITIAL_CONTENT_PAINT_MAX_ATTEMPTS = 120;
92+
const HISTORY_INITIAL_CONTENT_PAINT_MAX_ATTEMPTS = 30;
9393
const MOCK_BACKGROUND_ACTIVITIES_STORAGE_KEY = 'bitfun.flowChat.mockBackgroundActivities';
9494

9595
const MOCK_BACKGROUND_SUBAGENTS: BackgroundSubagentSummary[] = [

0 commit comments

Comments
 (0)