mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Optimize fetching recent chats by using Promise.all for concurrent data retrieval
This commit is contained in:
@ -261,7 +261,7 @@ async function getRecentChats() {
|
||||
};
|
||||
|
||||
/** @type {RecentChat[]} */
|
||||
const data = [...await charData(), ...await groupData()];
|
||||
const data = await Promise.all([charData(), groupData()]).then(res => res.flat());
|
||||
|
||||
data.sort((a, b) => sortMoments(timestampToMoment(a.last_mes), timestampToMoment(b.last_mes)))
|
||||
.map(chat => ({ chat, character: characters.find(x => x.avatar === chat.avatar), group: groups.find(x => x.id === chat.group) }))
|
||||
|
Reference in New Issue
Block a user