From 950244f6b00ff54c9c9ee40b2b0d16d980021f80 Mon Sep 17 00:00:00 2001 From: christine betts Date: Mon, 12 Jan 2026 11:53:04 -0500 Subject: [PATCH] Attempt to resolve OOM w/ useMemo on history items (#16424) --- .../cli/src/ui/components/MainContent.tsx | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/packages/cli/src/ui/components/MainContent.tsx b/packages/cli/src/ui/components/MainContent.tsx index a60f782d8f..f46a9c0c2f 100644 --- a/packages/cli/src/ui/components/MainContent.tsx +++ b/packages/cli/src/ui/components/MainContent.tsx @@ -36,17 +36,26 @@ export const MainContent = () => { availableTerminalHeight, } = uiState; - const historyItems = uiState.history.map((h) => ( - - )); + const historyItems = useMemo( + () => + uiState.history.map((h) => ( + + )), + [ + uiState.history, + mainAreaWidth, + staticAreaMaxItemHeight, + uiState.slashCommands, + ], + ); const pendingItems = useMemo( () => (