Procházet zdrojové kódy

fix: updating the array using push in zustand does not actually trigger component updates

Jiacheng Dong před 2 roky
rodič
revize
1d42e955fc
1 změnil soubory, kde provedl 4 přidání a 2 odebrání
  1. 4 2
      app/store/chat.ts

+ 4 - 2
app/store/chat.ts

@@ -317,8 +317,10 @@ export const useChatStore = create<ChatStore>()(
             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,