From 385e3cc59ba5ac28f84225f1452baf80a35903d3 Mon Sep 17 00:00:00 2001 From: alechkos <93551621+alechkos@users.noreply.github.com> Date: Fri, 30 May 2025 15:53:36 +0300 Subject: [PATCH] fix: chat instance retrieving in `syncHistory` (#3342) --- src/Client.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Client.js b/src/Client.js index 38f5af3..3f339ce 100644 --- a/src/Client.js +++ b/src/Client.js @@ -1762,8 +1762,9 @@ class Client extends EventEmitter { */ async syncHistory(chatId) { return await this.pupPage.evaluate(async (chatId) => { - const chat = await window.WWebJS.getChat(chatId); - if (chat.endOfHistoryTransferType === 0) { + const chatWid = window.Store.WidFactory.createWid(chatId); + const chat = window.Store.Chat.get(chatWid) ?? (await window.Store.Chat.find(chatWid)); + if (chat?.endOfHistoryTransferType === 0) { await window.Store.HistorySync.sendPeerDataOperationRequest(3, { chatId: chat.id });