From 76e93487217e26558a19403f2d81eab97b07285d Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Mon, 13 Apr 2026 16:48:32 +0200 Subject: [PATCH] fix(structures): use loadEarlierMsgs options signature in fetchMessages WhatsApp Web changed the signature of WAWebChatLoadMessages.loadEarlierMsgs from positional (chat, msgCollection) to an options object {chat, msgCollection, signal, threadId, trigger}. Calling the old positional form crashes with "Cannot read properties of undefined (reading 'waitForChatLoading')" because the destructure reads e.chat on the first positional argument instead of treating the first argument as the chat. Updates both Chat.fetchMessages and Channel.fetchMessages to pass the options object. No other behaviour change. --- src/structures/Channel.js | 2 +- src/structures/Chat.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/structures/Channel.js b/src/structures/Channel.js index 7f4bee9676..cd3e08786f 100644 --- a/src/structures/Channel.js +++ b/src/structures/Channel.js @@ -353,7 +353,7 @@ class Channel extends Base { while (msgs.length < searchOptions.limit) { const loadedMessages = await window .require('WAWebChatLoadMessages') - .loadEarlierMsgs(channel); + .loadEarlierMsgs({ chat: channel }); if (!loadedMessages || !loadedMessages.length) break; msgs = [...loadedMessages.filter(msgFilter), ...msgs]; } diff --git a/src/structures/Chat.js b/src/structures/Chat.js index 8cea7c134e..40211bf04d 100644 --- a/src/structures/Chat.js +++ b/src/structures/Chat.js @@ -226,7 +226,7 @@ class Chat extends Base { while (msgs.length < searchOptions.limit) { const loadedMessages = await window .require('WAWebChatLoadMessages') - .loadEarlierMsgs(chat, chat.msgs); + .loadEarlierMsgs({ chat }); if (!loadedMessages || !loadedMessages.length) break; msgs = [...loadedMessages.filter(msgFilter), ...msgs]; }