diff --git a/src/Socket/messages-recv.ts b/src/Socket/messages-recv.ts index 0fe003e..6c7ca7d 100644 --- a/src/Socket/messages-recv.ts +++ b/src/Socket/messages-recv.ts @@ -135,7 +135,6 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => { const histNotification = protocolMsg!.historySyncNotification logger.info({ histNotification, id: message.key.id }, 'got history notification') - const { chats, contacts, messages, isLatest } = await downloadAndProcessHistorySyncNotification(histNotification, historyCache) const meJid = authState.creds.me!.id await sendNode({ @@ -147,6 +146,8 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => { } }) + const { chats, contacts, messages, isLatest } = await downloadAndProcessHistorySyncNotification(histNotification, historyCache) + if(chats.length) { ev.emit('chats.set', { chats, isLatest }) }