From d2d5064eedef411eade75e099fabf819a23e5893 Mon Sep 17 00:00:00 2001 From: Murphy <69335326+MurphyLo@users.noreply.github.com> Date: Tue, 7 Oct 2025 00:02:48 +0800 Subject: [PATCH] fix: forked topic and rename modal retaining old name after rename (#10528) fix: sync active topic metadata after rename --- src/renderer/src/hooks/useTopic.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/renderer/src/hooks/useTopic.ts b/src/renderer/src/hooks/useTopic.ts index d2a71622fd..990cb12db8 100644 --- a/src/renderer/src/hooks/useTopic.ts +++ b/src/renderer/src/hooks/useTopic.ts @@ -48,6 +48,17 @@ export function useActiveTopic(assistantId: string, topic?: Topic) { } }, [activeTopic?.id, assistant]) + useEffect(() => { + if (!assistant?.topics?.length || !activeTopic) { + return + } + + const latestTopic = assistant.topics.find((item) => item.id === activeTopic.id) + if (latestTopic && latestTopic !== activeTopic) { + setActiveTopic(latestTopic) + } + }, [assistant?.topics, activeTopic]) + return { activeTopic, setActiveTopic } }