fix: fetchMessages infinite loop when there are no messages in the chat (#1480)

* Fix of fetchMessages

* Node 12 compatibility
This commit is contained in:
jurajmatus
2022-06-14 06:22:53 +02:00
committed by GitHub
parent c0ef9223ed
commit 98ff761cfb

View File

@@ -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];
} }