refactor(structures): optimize message loading with msgFindBefore#201705
refactor(structures): optimize message loading with msgFindBefore#201705JuniorRibas wants to merge 3 commits intowwebjs:mainfrom
Conversation
- Use msgFindLocal.msgFindBefore instead of loadEarlierMsgs when filling search limit. - Resolve message models via MsgStore when results are not yet serialized. Made-with: Cursor
- Mirror wa-js getMessages: MsgKey.fromString, msgFindByDirection when available, fetch count-1 before anchor then include anchor message, slice(-limit). - Dedupe, sort by t, safer model resolution; loop for fromMe and Infinity. Made-with: Cursor
|
works for me as expected for chats and channels. |
|
The PR fix worked as expected. Everything is working correctly now |
1 similar comment
|
The PR fix worked as expected. Everything is working correctly now |
|
Some conversations (even recent ones, from the same day, the previous day, etc.) only return one message, when in fact there are more messages. I haven't been able to identify why yet, but this problem didn't occur before. |
under circumstances this is actually true. The fix is to add msgs to merged like this in the PR: Chat and Channels change to: afterwards it works |
|
That is a better solution for the problem |
Description
Replaces
WAWebChatLoadMessages.loadEarlierMsgswithWAWebDBMessageFindLocal.msgFindBeforewhen paginating messages until reachingsearchOptions.limitin bothChatandChannel, resolving models throughMsgStorewhen the returned entries are not yet serialized.Related Issue(s)
N/A
Testing Summary
Test Details
npx eslinton the modified files: OK.npm testrequiresWWEBJS_TEST_REMOTE_ID(integration). Manual validation is recommended for message fetching withlimitin chats/channels.Environment
await client.getWWebVersion())Type of Change
Checklist
npm test). (integration suite requires environment variables)Closes #201706
Closes #201706