mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 18:50:56 +08:00
fix: ensure topic is created if not found in loadTopicMessagesThunk
* Added logic to create a new topic with an empty messages array if the specified topic does not exist in the database.
This commit is contained in:
parent
e00f03db2b
commit
fb548ca20a
@ -721,6 +721,11 @@ export const loadTopicMessagesThunk =
|
||||
|
||||
try {
|
||||
const topic = await db.topics.get(topicId)
|
||||
|
||||
if (!topic) {
|
||||
await db.topics.add({ id: topicId, messages: [] })
|
||||
}
|
||||
|
||||
const messagesFromDB = topic?.messages || []
|
||||
|
||||
if (messagesFromDB.length > 0) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user