feat(FN-4056): remove queued warning toasts

Removed queued warning toasts from chat queueing flows in `useChat` and `useQuickChat` hooks, with corresponding test coverage for the queueing behavior without the toast.

Fusion-Task-Id: FN-4056
This commit is contained in:
Fusion
2026-05-11 19:15:03 -07:00
committed by gsxdsm
parent 37394966ae
commit dcdcbd7644
4 changed files with 8 additions and 6 deletions

View File

@@ -966,14 +966,15 @@ describe("useChat", () => {
});
});
it("sending during streaming queues pendingMessage", async () => {
it("sending during streaming queues pendingMessage without warning toast", async () => {
const session = makeSession({ id: "session-001", agentId: "agent-001" });
mockFetchChatSessions.mockResolvedValueOnce({ sessions: [session] });
mockFetchChatMessages.mockResolvedValueOnce({ messages: [] });
const addToast = vi.fn();
mockStreamChatResponse.mockReturnValue({ close: vi.fn(), isConnected: () => true });
const { result } = renderHook(() => useChat("proj-123"));
const { result } = renderHook(() => useChat("proj-123", addToast));
await waitFor(() => {
expect(result.current.sessions).toHaveLength(1);
@@ -1001,6 +1002,7 @@ describe("useChat", () => {
expect(result.current.pendingMessage).toBe("Queued message");
expect(mockStreamChatResponse).toHaveBeenCalledTimes(1);
expect(addToast).not.toHaveBeenCalledWith("Still waiting for previous response — message queued", "warning");
});
describe("queued message closure behavior", () => {

View File

@@ -571,14 +571,15 @@ describe("useQuickChat", () => {
});
});
it("sending during streaming queues message", async () => {
it("sending during streaming queues message without warning toast", async () => {
const existingSession = makeSession({ id: "session-existing", agentId: "agent-001" });
const addToast = vi.fn();
mockFetchResumeChatSession.mockResolvedValueOnce({ session: existingSession });
mockFetchChatMessages.mockResolvedValue({ messages: [] });
mockStreamChatResponse.mockReturnValue({ close: vi.fn(), isConnected: () => true });
const { result } = renderHook(() => useQuickChat("proj-123"));
const { result } = renderHook(() => useQuickChat("proj-123", addToast));
await act(async () => {
await result.current.switchSession("agent-001");
@@ -598,6 +599,7 @@ describe("useQuickChat", () => {
expect(result.current.pendingMessage).toBe("Queued follow-up");
expect(mockStreamChatResponse).toHaveBeenCalledTimes(1);
expect(addToast).not.toHaveBeenCalledWith("Still waiting for previous response — message queued", "warning");
});
it("starts a fresh stream and shows active state on second turn after first turn completes", async () => {

View File

@@ -558,7 +558,6 @@ export function useChat(
if (isStreamingRef.current) {
pendingMessageRef.current = content;
setPendingMessage(content);
addToast?.("Still waiting for previous response — message queued", "warning");
return;
}

View File

@@ -632,7 +632,6 @@ export function useQuickChat(
pendingMessageRef.current = content;
setPendingMessage(content);
addToast?.("Still waiting for previous response — message queued", "warning");
return Promise.resolve();
}