refactor(cli): cleanup and simplify UI components

- Simplified tool visibility logic in .
- Reduced UI refresh delay in  for a more responsive user experience.
- Reorder imports and hook definitions within AppContainer.tsx to reduce diff 'noise'.
This commit is contained in:
Jarrod Whelan
2026-03-25 01:06:07 -07:00
parent 32c8ac6975
commit 1f0248d8df
3 changed files with 14 additions and 19 deletions

View File

@@ -167,6 +167,12 @@ import { useIsHelpDismissKey } from './utils/shortcutsHelp.js';
import { useSuspend } from './hooks/useSuspend.js';
import { useRunEventNotifications } from './hooks/useRunEventNotifications.js';
import { isNotificationsEnabled } from '../utils/terminalNotifications.js';
import {
getLastTurnToolCallIds,
isToolExecuting,
isToolAwaitingConfirmation,
getAllToolCalls,
} from './utils/historyUtils.js';
interface AppContainerProps {
config: Config;
@@ -182,12 +188,6 @@ import {
APPROVAL_MODE_REVEAL_DURATION_MS,
} from './hooks/useVisibilityToggle.js';
import { useKeyMatchers } from './hooks/useKeyMatchers.js';
import {
getLastTurnToolCallIds,
isToolExecuting,
isToolAwaitingConfirmation,
getAllToolCalls,
} from './utils/historyUtils.js';
/**
* The fraction of the terminal width to allocate to the shell.
@@ -1167,6 +1167,11 @@ Logging in with Google... Restarting Gemini CLI to continue.
consumePendingHints,
);
const pendingHistoryItems = useMemo(
() => [...pendingSlashCommandHistoryItems, ...pendingGeminiHistoryItems],
[pendingSlashCommandHistoryItems, pendingGeminiHistoryItems],
);
toggleBackgroundShellRef.current = toggleBackgroundShell;
isBackgroundShellVisibleRef.current = isBackgroundShellVisible;
backgroundShellsRef.current = backgroundShells;
@@ -1189,11 +1194,6 @@ Logging in with Google... Restarting Gemini CLI to continue.
setIsBackgroundShellListOpenRef.current = setIsBackgroundShellListOpen;
const pendingHistoryItems = useMemo(
() => [...pendingSlashCommandHistoryItems, ...pendingGeminiHistoryItems],
[pendingSlashCommandHistoryItems, pendingGeminiHistoryItems],
);
const lastOutputTimeRef = useRef(0);
useEffect(() => {
@@ -1815,11 +1815,10 @@ Logging in with Google... Restarting Gemini CLI to continue.
toggleLastTurnTools();
// Force layout refresh after a short delay to allow the terminal layout to settle.
// This prevents the "blank screen" issue by ensuring Ink re-measures after
// any async subview updates are complete.
// Minimize "blank screen" issue after any async subview updates are complete.
setTimeout(() => {
refreshStatic();
}, 500);
}, 250);
return true;
} else if (

View File

@@ -88,7 +88,6 @@ export const MainContent = () => {
() =>
augmentedHistory.map(
({ item, isExpandable, isFirstThinking, isFirstAfterThinking }) => (
// ({ item, isExpandable, isFirstThinking, /* isFirstAfterThinking */ }) => (
<MemoizedHistoryItemDisplay
terminalWidth={mainAreaWidth}
availableTerminalHeight={

View File

@@ -635,9 +635,6 @@ export const useGeminiStream = (
return true;
};
const anyVisibleInHistory = pushedToolCallIds.size > 0;
const anyVisibleInPending = remainingTools.some(isToolVisible);
let lastVisibleIsCompact = false;
const isCompactModeEnabled = settings.merged.ui?.compactToolOutput === true;
for (let i = toolCalls.length - 1; i >= 0; i--) {
@@ -653,7 +650,7 @@ export const useGeminiStream = (
if (
toolCalls.length > 0 &&
!(allTerminal && allPushed) &&
(anyVisibleInHistory || anyVisibleInPending) &&
toolCalls.some(isToolVisible) &&
!lastVisibleIsCompact
) {
items.push({