mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-17 19:26:20 +00:00
fix: fetchMessages infinite loop when there are no messages in the chat (#1480)
* Fix of fetchMessages * Node 12 compatibility
This commit is contained in:
@@ -184,7 +184,7 @@ class Chat extends Base {
|
|||||||
if (searchOptions && searchOptions.limit > 0) {
|
if (searchOptions && searchOptions.limit > 0) {
|
||||||
while (msgs.length < searchOptions.limit) {
|
while (msgs.length < searchOptions.limit) {
|
||||||
const loadedMessages = await window.Store.ConversationMsgs.loadEarlierMsgs(chat);
|
const loadedMessages = await window.Store.ConversationMsgs.loadEarlierMsgs(chat);
|
||||||
if (!loadedMessages) break;
|
if (!loadedMessages || !loadedMessages.length) break;
|
||||||
msgs = [...loadedMessages.filter(msgFilter), ...msgs];
|
msgs = [...loadedMessages.filter(msgFilter), ...msgs];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user