change community fetch

This commit is contained in:
Felicio Mununga 2022-06-09 19:33:01 +02:00
parent c84ed7ac7b
commit d6c1ff0450
No known key found for this signature in database
GPG Key ID: 0EB8D75C775AB6F1
1 changed files with 6 additions and 3 deletions

View File

@ -79,10 +79,13 @@ export class Community {
await this.waku.store.queryHistory([this.communityContentTopic], {
decryptionKeys: [this.communityDecryptionKey],
// oldest message first
callback: wakuMessages => {
// todo: iterate from right
for (const wakuMessage of wakuMessages.reverse()) {
this.client.handleWakuMessage(wakuMessage)
let index = wakuMessages.length
// most recent page first
while (--index >= 0) {
this.client.handleWakuMessage(wakuMessages[index])
if (!this.communityMetadata) {
return shouldStop