From d0cb333f3ce6b1b7a33413ce9d4153f1517e8465 Mon Sep 17 00:00:00 2001 From: ousugo Date: Thu, 3 Apr 2025 18:35:01 +0800 Subject: [PATCH] fix(TopicsTab): Topic prompt word modification does not take effect immediately --- .../src/pages/home/Tabs/TopicsTab.tsx | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/pages/home/Tabs/TopicsTab.tsx b/src/renderer/src/pages/home/Tabs/TopicsTab.tsx index d92b0d45..0773fd97 100644 --- a/src/renderer/src/pages/home/Tabs/TopicsTab.tsx +++ b/src/renderer/src/pages/home/Tabs/TopicsTab.tsx @@ -204,7 +204,13 @@ const Topics: FC = ({ assistant: _assistant, activeTopic, setActiveTopic allowClear: true } }) - prompt !== null && updateTopic({ ...topic, prompt: prompt.trim() }) + + prompt !== null && + (() => { + const updatedTopic = { ...topic, prompt: prompt.trim() } + updateTopic(updatedTopic) + topic.id === activeTopic.id && setActiveTopic(updatedTopic) + })() } }, { @@ -339,7 +345,18 @@ const Topics: FC = ({ assistant: _assistant, activeTopic, setActiveTopic return menus }, - [assistant, assistants, onClearMessages, onDeleteTopic, onPinTopic, onMoveTopic, t, updateTopic] + [ + t, + assistants, + assistant, + updateTopic, + activeTopic.id, + setActiveTopic, + onPinTopic, + onClearMessages, + onMoveTopic, + onDeleteTopic + ] ) return (