From 1d42e955fc60365477ec9e4b38077dc5c6676924 Mon Sep 17 00:00:00 2001 From: Jiacheng Dong <43509711+Jiacheng787@users.noreply.github.com> Date: Thu, 15 Jun 2023 10:55:25 +0800 Subject: [PATCH] fix: updating the array using push in zustand does not actually trigger component updates --- app/store/chat.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/store/chat.ts b/app/store/chat.ts index 455399b80..335e4be7e 100644 --- a/app/store/chat.ts +++ b/app/store/chat.ts @@ -317,8 +317,10 @@ export const useChatStore = create()( botMessage.streaming = false; userMessage.isError = !isAborted; botMessage.isError = !isAborted; - - set(() => ({})); + get().updateCurrentSession((session) => { + session.messages = session.messages.concat(); + }); + // set(() => ({})); ChatControllerPool.remove( sessionIndex, botMessage.id ?? messageIndex,