Skip to content

Commit 758baba

Browse files
committed
fix(chat): give "New work item" visible feedback on the fresh screen
Clicking it while already on a fresh conversation navigated to the exact state already displayed - same project, same composer - so the button read as dead. The trigger now also lands the cursor in the composer.
1 parent 2ef9b09 commit 758baba

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/components/chat/view/ChatInterface.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,18 @@ function ChatInterface({
118118
setPendingPermissionRequests,
119119
});
120120

121+
122+
// "New work item" while a fresh conversation is already on screen changes
123+
// nothing visible — same project, same composer — so the click reads as
124+
// dead. The state reset happens in the session-state hook; here the click
125+
// also lands the cursor in the box, which is the only feedback that state
126+
// can offer.
127+
const previousFocusTrigger = useRef(newSessionTrigger ?? 0);
128+
useEffect(() => {
129+
if ((newSessionTrigger ?? 0) === previousFocusTrigger.current) return;
130+
previousFocusTrigger.current = newSessionTrigger ?? 0;
131+
composer.textareaRef.current?.focus();
132+
}, [composer.textareaRef, newSessionTrigger]);
121133
useEffect(() => {
122134
const prior = reasoningSessionRef.current;
123135
const selected = selectedSession?.id ?? null;

0 commit comments

Comments
 (0)