From 24cdadf4ea339ea04ff03b552c91304736f01d03 Mon Sep 17 00:00:00 2001 From: BenyFilho <168232825+BenyFilho@users.noreply.github.com> Date: Mon, 6 Apr 2026 11:27:38 -0300 Subject: [PATCH 1/2] Fixing getContacts revolve all promisses Fixing getContacts revolve all promisses --- src/util/Injected/Utils.js | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/util/Injected/Utils.js b/src/util/Injected/Utils.js index 53cc348794..535271f527 100644 --- a/src/util/Injected/Utils.js +++ b/src/util/Injected/Utils.js @@ -1080,19 +1080,27 @@ exports.LoadUtils = () => { const contacts = window .require('WAWebCollections') .Contact.getModelsArray(); - return contacts.map(async (contact) => { - if (contact.isBusiness || contact.isEnterprise) { - const contactWid = window - .require('WAWebWidFactory') - .createWid(contact.id); - const bizProfile = await window - .require('WAWebCollections') - .BusinessProfile.find(contactWid); - bizProfile.profileOptions && - (contact.businessProfile = bizProfile); - } - return window.WWebJS.getContactModel(contact); - }); + return Promise.all( + contacts.map((contact) => { + if (contact.isBusiness || contact.isEnterprise) { + const contactWid = window + .require('WAWebWidFactory') + .createWid(contact.id); + + return window + .require('WAWebCollections') + .BusinessProfile.find(contactWid) + .then((bizProfile) => { + if (bizProfile?.profileOptions) { + contact.businessProfile = bizProfile; + } + return window.WWebJS.getContactModel(contact); + }); + } + + return Promise.resolve(window.WWebJS.getContactModel(contact)); + }), + ); }; window.WWebJS.mediaInfoToFile = ({ data, mimetype, filename }) => { From 3f2886f5f1e79669f9c73736f79635b83e7fe9c9 Mon Sep 17 00:00:00 2001 From: BenyFilho <168232825+BenyFilho@users.noreply.github.com> Date: Mon, 6 Apr 2026 17:50:10 -0300 Subject: [PATCH 2/2] Update Utils.js --- src/util/Injected/Utils.js | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/util/Injected/Utils.js b/src/util/Injected/Utils.js index 535271f527..c3b421b7bb 100644 --- a/src/util/Injected/Utils.js +++ b/src/util/Injected/Utils.js @@ -1081,24 +1081,14 @@ exports.LoadUtils = () => { .require('WAWebCollections') .Contact.getModelsArray(); return Promise.all( - contacts.map((contact) => { + contacts.map(async (contact) => { if (contact.isBusiness || contact.isEnterprise) { - const contactWid = window - .require('WAWebWidFactory') - .createWid(contact.id); - - return window + await window .require('WAWebCollections') - .BusinessProfile.find(contactWid) - .then((bizProfile) => { - if (bizProfile?.profileOptions) { - contact.businessProfile = bizProfile; - } - return window.WWebJS.getContactModel(contact); - }); + .BusinessProfile.find(contact.id) + .catch(() => {}); } - - return Promise.resolve(window.WWebJS.getContactModel(contact)); + return window.WWebJS.getContactModel(contact); }), ); };