fix: getContacts resolving all promisses#201698
Open
BenyFilho wants to merge 5 commits intowwebjs:mainfrom
Open
fix: getContacts resolving all promisses#201698BenyFilho wants to merge 5 commits intowwebjs:mainfrom
BenyFilho wants to merge 5 commits intowwebjs:mainfrom
Conversation
Fixing getContacts revolve all promisses
Contributor
|
@BenyFilho Nice work, thanks for fixing this! A few suggestions:
Suggested version: window.WWebJS.getContacts = async () => {
const contacts = window.require('WAWebCollections').Contact.getModelsArray();
return Promise.all(
contacts.map(async (contact) => {
if (contact.isBusiness || contact.isEnterprise) {
await window.require('WAWebCollections')
.BusinessProfile.find(contact.id)
.catch(() => {});
}
return window.WWebJS.getContactModel(contact);
})
);
} |
Adi1231234
approved these changes
Apr 6, 2026
Contributor
|
Great! Approved :) @BenyFilho |
Adi1231234
approved these changes
Apr 6, 2026
tuyuribr
approved these changes
Apr 7, 2026
sofi-ans
approved these changes
Apr 8, 2026
themazim
added a commit
to themazim/whatsapp-web.js
that referenced
this pull request
Apr 8, 2026
getContacts returned an array of unresolved promises instead of contact data because contacts.map(async ...) was not wrapped in Promise.all(). Also simplifies BusinessProfile.find() by passing contact.id directly instead of creating a Wid first. Port of upstream wwebjs#201698.
Contributor
|
works as expected. |
elhumbertoz
added a commit
to elhumbertoz/whatsapp-web.js
that referenced
this pull request
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixing getContacts resolving all promises
Description
Fixing getContacts resolving all promises
Related Issue(s)
Closes #201690
Testing Summary
Test Details
Environment
Windows 10
Phone OS:
Android 11
Library Version:
1.34.6 - #main branch with recent changes
2.3000.1036716141
Chrome 146.0.7680.178
18.20.2
Type of Change
Checklist
npm test).index.d.ts) have been updated if necessary.example.js) / documentation have been updated if applicable.