mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 10:40:07 +08:00
fix: forked topic and rename modal retaining old name after rename (#10528)
fix: sync active topic metadata after rename
This commit is contained in:
parent
8bec7640fa
commit
d2d5064eed
@ -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 }
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user