Преглед на файлове

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

Jiacheng Dong преди 1 година
родител
ревизия
1d42e955fc
променени са 1 файла, в които са добавени 4 реда и са изтрити 2 реда
  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,