fix: prevent crash when switching between agent and assistant (#12252)
Some checks failed
Auto I18N Weekly / Auto I18N (push) Has been cancelled

This commit is contained in:
Zhaolin Liang 2026-01-03 17:20:52 +08:00 committed by GitHub
parent ca2b0ac28d
commit 2a3955919e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -96,7 +96,7 @@ export const TopicManagePanel: React.FC<TopicManagePanelProps> = ({
// Topics that can be selected (non-pinned, and filtered when in search mode)
const selectableTopics = useMemo(() => {
const baseTopics = isSearchMode ? filteredTopics : assistant.topics
return baseTopics.filter((topic) => !topic.pinned)
return (baseTopics ?? []).filter((topic) => !topic.pinned)
}, [assistant.topics, filteredTopics, isSearchMode])
// Check if all selectable topics are selected