From 814b15b834cb7dfea9f90931439102ec898bb7d3 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 d92b0d4509..0773fd9796 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 (