Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion ui/desktop/src/components/Hub.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { AppEvents } from '../constants/events';
* Hub (input submission) → Create Session → Pair (with session ID and initial message)
*/

import { useState } from 'react';
import { useEffect, useRef, useState } from 'react';
import { SessionInsights } from './sessions/SessionsInsights';
import ChatInput from './ChatInput';
import { ChatState } from '../types/chatState';
Expand All @@ -39,6 +39,15 @@ export default function Hub({
const { extensionsList } = useConfig();
const [workingDir, setWorkingDir] = useState(getInitialWorkingDir());
const [isCreatingSession, setIsCreatingSession] = useState(false);
const inputRef = useRef<HTMLTextAreaElement>(null);

// rAF is more reliable than autoFocus across async render boundaries (Suspense, OnboardingGuard, etc.)
useEffect(() => {
const frameId = requestAnimationFrame(() => {
inputRef.current?.focus();
});
return () => cancelAnimationFrame(frameId);
}, []);

const handleSubmit = async (input: UserInput) => {
const { msg: userMessage, images } = input;
Expand Down Expand Up @@ -101,6 +110,7 @@ export default function Hub({
sessionCosts={undefined}
toolCount={0}
onWorkingDirChange={setWorkingDir}
inputRef={inputRef}
/>
</div>
</div>
Expand Down
Loading