From d5f32690a417f92646a7cc5a1c884f5249718778 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Fri, 8 Mar 2024 20:34:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BD=93=E9=AA=8C:=20?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E8=A1=A8=E5=8D=95=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/FormStore.js | 7 +++++-- src/views/ChatHistory.jsx | 7 ++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/stores/FormStore.js b/src/stores/FormStore.js index 7fef332..e303415 100644 --- a/src/stores/FormStore.js +++ b/src/stores/FormStore.js @@ -7,7 +7,10 @@ import { devtools } from 'zustand/middleware'; import { WS_URL } from '@/config'; export const useFormStore = create(devtools((set, get) => ({ - chatHistory: {}, - setChatHistory: (chatHistory) => set({ chatHistory }), + // 历史记录页面 + chatHistoryForm: {}, + setChatHistoryForm: (chatHistoryForm) => set({ chatHistoryForm, chatHistorySelectChat: {} }), + chatHistorySelectChat: {}, + setChatHistorySelectChat: (chatHistorySelectChat) => set({ chatHistorySelectChat }), }))); export default useFormStore; diff --git a/src/views/ChatHistory.jsx b/src/views/ChatHistory.jsx index 4cfcfa1..84dc708 100644 --- a/src/views/ChatHistory.jsx +++ b/src/views/ChatHistory.jsx @@ -188,10 +188,8 @@ const SearchForm = memo(function ({ initialValues, onSubmit }) { function ChatHistory() { // const [formValues, setFormValues] = useState({}); - const [formValues, setFormValues] = useFormStore( - useShallow((state) => [state.chatHistory, state.setChatHistory]), - ) - + const [formValues, setFormValues] = useFormStore(useShallow((state) => [state.chatHistoryForm, state.setChatHistoryForm])); + const [selectedConversation, setSelectedConversation] = useFormStore(useShallow((state) => [state.chatHistorySelectChat, state.setChatHistorySelectChat])); const handleSubmit = useCallback((values) => { setFormValues({ ...values }); @@ -199,7 +197,6 @@ function ChatHistory() { const [loading, setLoading] = useState(false); const [conversationsList, setConversationsList] = useState([]); - const [selectedConversation, setSelectedConversation] = useState({}); const [chatItemMessages, setChatItemMessages] = useState([]); const getConversationsList = async () => { setLoading(true);