Optimize VirtualizedList

Checkpoint optimizing virtualized list

Fixes for fallback rendering where terminalBuffer=false
Change terminalBuffer false back to the default while we fix performance
with very large chats.

Checkpoint changes to virtualized list.

Fix virtualized list

NO commit

Update ink version.

Fix UI snapshot mismatch in MainContent tests and VirtualizedList computation

Checkpoint.

Optimize scrolling checkpoint

Fix tests and resolve remaining issues after rebase

- Fixed ToolStickyHeaderRegression scrolling logic.
- Added MouseProvider to VirtualizedList test.
- Updated snapshots to reflect layout changes in optimized virtual list.

Fix flaky plan-mode test by removing model request assertions

Fix unit tests by updating expected decisions for tool permissions after rebase

use onStaticRender in VirtualizedList

Checkpoint VirtualizedListClick

Update version

Bug fixes.

Code review comment fixes.

settings.json hack

Update version and local tweaks.
This commit is contained in:
jacob314
2026-04-06 21:30:30 -07:00
parent f8541cf7a2
commit 44259a00e2
53 changed files with 3379 additions and 545 deletions
@@ -5,8 +5,8 @@
*/
import type React from 'react';
import { useEffect, useId, useRef, useCallback } from 'react';
import { Box, Text, type DOMElement } from 'ink';
import { useEffect, useId, useCallback } from 'react';
import { Box, Text } from 'ink';
import {
UPDATE_TOPIC_TOOL_NAME,
UPDATE_TOPIC_DISPLAY_NAME,
@@ -18,12 +18,14 @@ import type { IndividualToolCallDisplay } from '../../types.js';
import { theme } from '../../semantic-colors.js';
import { useOverflowActions } from '../../contexts/OverflowContext.js';
import { useToolActions } from '../../contexts/ToolActionsContext.js';
import { useMouseClick } from '../../hooks/useMouseClick.js';
import { useVirtualizedListClick } from '../../hooks/useVirtualizedListClick.js';
interface TopicMessageProps extends IndividualToolCallDisplay {
terminalWidth: number;
availableTerminalHeight?: number;
isExpandable?: boolean;
// TopicMessage is only interactive when rendered inside VirtualizedList.
itemKey?: string;
}
export const isTopicTool = (name: string): boolean =>
@@ -34,6 +36,7 @@ export const TopicMessage: React.FC<TopicMessageProps> = ({
args,
availableTerminalHeight,
isExpandable = true,
itemKey,
}) => {
const { isExpanded: isExpandedInContext, toggleExpansion } = useToolActions();
@@ -47,7 +50,6 @@ export const TopicMessage: React.FC<TopicMessageProps> = ({
const overflowActions = useOverflowActions();
const uniqueId = useId();
const overflowId = `topic-${uniqueId}`;
const containerRef = useRef<DOMElement>(null);
const rawTitle = args?.[TOPIC_PARAM_TITLE];
const title = typeof rawTitle === 'string' ? rawTitle : undefined;
@@ -75,9 +77,14 @@ export const TopicMessage: React.FC<TopicMessageProps> = ({
}
}, [toggleExpansion, hasExtraSummary, callId]);
useMouseClick(containerRef, handleToggle, {
isActive: isExpandable && hasExtraSummary,
});
const clickableProps = useVirtualizedListClick(
itemKey,
'toggle',
handleToggle,
{
isActive: isExpandable && hasExtraSummary,
},
);
useEffect(() => {
// Only register if there is more content (summary) and it's currently hidden
@@ -95,7 +102,7 @@ export const TopicMessage: React.FC<TopicMessageProps> = ({
}, [isExpandable, hasExtraSummary, isExpanded, overflowActions, overflowId]);
return (
<Box ref={containerRef} flexDirection="column" marginLeft={2}>
<Box ref={clickableProps.ref} flexDirection="column" marginLeft={2}>
<Box flexDirection="row" flexWrap="wrap">
<Text color={theme.text.primary} bold wrap="truncate-end">
{title || 'Topic'}