fix(FN-2011): keep chat input responsive during streaming

- Make useChat and useQuickChat sendMessage synchronous and update consumers to call it without awaiting
- Allow ChatView and QuickChatFAB inputs to remain editable while responses stream
- Keep quick chat send disabled during active streaming to prevent concurrent sends
- Add hook and component tests for synchronous sendMessage and non-blocking input behavior
This commit is contained in:
Fusion
2026-04-17 15:38:32 -07:00
committed by gsxdsm
parent 47c0dc41e1
commit 57736beb06
8 changed files with 134 additions and 28 deletions

View File

@@ -461,21 +461,17 @@ export function ChatView({ projectId, addToast }: ChatViewProps) {
);
// Handle send message
const handleSend = useCallback(async () => {
const handleSend = useCallback(() => {
const trimmed = messageInput.trim();
if (!trimmed || isStreaming || !activeSession) return;
if (!trimmed || !activeSession) return;
setMessageInput("");
setShowSkillMenu(false);
setSkillFilter("");
setMentionPopupVisible(false);
setMentionFilter("");
setMentionStartPos(-1);
try {
await sendMessage(trimmed);
} catch {
addToast("Failed to send message", "error");
}
}, [messageInput, isStreaming, activeSession, sendMessage, addToast]);
sendMessage(trimmed);
}, [messageInput, activeSession, sendMessage]);
const handleSkillSelect = useCallback(
(skill: DiscoveredSkill) => {
@@ -1069,7 +1065,6 @@ export function ChatView({ projectId, addToast }: ChatViewProps) {
onClick={handleInputSelectionChange}
onBlur={handleInputBlur}
onFocus={handleInputFocus}
disabled={isStreaming}
rows={1}
data-testid="chat-input"
/>