mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-13 07:30:52 -07:00
Speculative fixes to try to fix react error. (#19508)
This commit is contained in:
@@ -80,20 +80,24 @@ export function useFocusHint(
|
||||
isThisShellFocused: boolean,
|
||||
resultDisplay: ToolResultDisplay | undefined,
|
||||
) {
|
||||
const [lastUpdateTime, setLastUpdateTime] = useState<Date | null>(null);
|
||||
const [userHasFocused, setUserHasFocused] = useState(false);
|
||||
|
||||
// Derive a stable reset key for the inactivity timer. For strings and arrays
|
||||
// (shell output), we use the length to capture updates without referential
|
||||
// identity issues or expensive deep comparisons.
|
||||
const resetKey =
|
||||
typeof resultDisplay === 'string'
|
||||
? resultDisplay.length
|
||||
: Array.isArray(resultDisplay)
|
||||
? resultDisplay.length
|
||||
: !!resultDisplay;
|
||||
|
||||
const showFocusHint = useInactivityTimer(
|
||||
isThisShellFocusable,
|
||||
lastUpdateTime ? lastUpdateTime.getTime() : 0,
|
||||
resetKey,
|
||||
SHELL_FOCUS_HINT_DELAY_MS,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (resultDisplay) {
|
||||
setLastUpdateTime(new Date());
|
||||
}
|
||||
}, [resultDisplay]);
|
||||
|
||||
useEffect(() => {
|
||||
if (isThisShellFocused) {
|
||||
setUserHasFocused(true);
|
||||
|
||||
Reference in New Issue
Block a user