From 67dddcb224b560b6ee84d64c72b8dfce3dfce277 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Sat, 5 Oct 2024 02:46:32 +0530 Subject: [PATCH] fix(stream): while updating conv id --- frontend/src/conversation/Conversation.tsx | 4 ---- frontend/src/conversation/conversationSlice.ts | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index d5908ca30..7bcfbbf6c 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -54,10 +54,6 @@ export default function Conversation() { } }, []); - useEffect(() => { - fetchStream.current && fetchStream.current.abort(); - }, [conversationId]); - useEffect(() => { if (queries.length) { queries[queries.length - 1].error && setLastQueryReturnedErr(true); diff --git a/frontend/src/conversation/conversationSlice.ts b/frontend/src/conversation/conversationSlice.ts index bf3753119..1b7e9d41e 100644 --- a/frontend/src/conversation/conversationSlice.ts +++ b/frontend/src/conversation/conversationSlice.ts @@ -151,6 +151,7 @@ export const conversationSlice = createSlice({ state, action: PayloadAction<{ index: number; query: Partial }>, ) { + if (state.status === 'idle') return; const { index, query } = action.payload; if (query.response != undefined) { state.queries[index].response = @@ -167,6 +168,7 @@ export const conversationSlice = createSlice({ action: PayloadAction<{ query: Partial }>, ) { state.conversationId = action.payload.query.conversationId ?? null; + state.status = 'idle'; }, updateStreamingSource( state,