## CHANGES

- Smoothed tab switching by resizing textarea only when active tab changes 🚀
- Reduced costly layout reflows by dropping per-keystroke resize dependencies 
- Prevented agent-config undefined states during slow SSH detection with fallbacks 🛡️
- Added placeholder agent configs from tiles to handle detection race conditions 🧩
This commit is contained in:
Pedram Amini
2026-01-11 13:05:32 -06:00
parent 1d34eb6f2b
commit 975f23e4b3
2 changed files with 20 additions and 3 deletions

View File

@@ -282,14 +282,16 @@ export const InputArea = React.memo(function InputArea(props: InputAreaProps) {
.slice(0, 10);
}, [currentCommandHistory, commandHistoryFilterLower]);
// Auto-resize textarea when inputValue changes externally (e.g., tab switch)
// Auto-resize textarea when switching tabs
// This ensures the textarea height matches the content when switching between tabs
// PERF: Only depend on activeTabId, NOT inputValue - inputValue changes on every keystroke
// and would cause expensive layout reflow (scrollHeight access) on each character typed
useEffect(() => {
if (inputRef.current) {
inputRef.current.style.height = 'auto';
inputRef.current.style.height = `${Math.min(inputRef.current.scrollHeight, 112)}px`;
}
}, [inputValue, inputRef]);
}, [session.activeTabId, inputRef]);
// Show summarization progress overlay when active for this tab
if (isSummarizing && session.inputMode === 'ai' && onCancelSummarize) {

View File

@@ -750,8 +750,23 @@ export function AgentSelectionScreen({ theme }: AgentSelectionScreenProps): JSX.
}, [configuringAgentId]);
// Get the agent being configured
const configuringAgent = detectedAgents.find(a => a.id === configuringAgentId);
// When SSH detection is in progress, detectedAgents may be stale or empty.
// Create a fallback agent config from AGENT_TILES to prevent undefined state.
const configuringTile = AGENT_TILES.find(t => t.id === configuringAgentId);
const detectedConfigAgent = detectedAgents.find(a => a.id === configuringAgentId);
// If agent not in detectedAgents but we have a tile, create a placeholder
// This handles the race condition when SSH detection is slow/pending
const configuringAgent: AgentConfig | undefined = detectedConfigAgent ?? (
configuringAgentId && configuringTile ? {
id: configuringAgentId,
name: configuringTile.name,
available: false, // Will be updated when detection completes
path: undefined,
hidden: false,
capabilities: undefined, // Will be populated when detection completes
} : undefined
);
// Loading state
if (isDetecting) {