Closed marcosvrs closed 11 months ago
@CodiumAI-Agent /review
🎯 Main theme: This PR is a workaround for an issue where the injection of the WPP library throws an error if the WhatsApp web app isn't completely loaded. The solution is to wait until the class wf-loading
is added to the html element, indicating that the web app is loaded, before injecting the WPP library.
📝 PR summary: The PR modifies the wa-js.ts
file to check for the presence of the wf-loading
class in the html element before injecting the WPP library. It also introduces a MutationObserver to watch for changes in the html element's class attribute. Additionally, it modifies the manifest.json
file to include wppconnect.js
in the list of web accessible resources.
📌 Type of PR: Bug fix
🧪 Relevant tests added: No
⏱️ Estimated effort to review [1-5]: 4, because the PR involves changes in the core functionality of the application and requires a deep understanding of the WPP library and the MutationObserver API.
🔒 Security concerns: No security concerns found
💡 General suggestions: The PR addresses a critical issue and provides a workaround solution. However, it would be beneficial to include error handling for the import statement and the observer. Also, it would be better to encapsulate the logic of checking the wf-loading
class and injecting the WPP library into a separate function for better readability and maintainability.
As a workaround on the current issue where the injection of the WPP library throws an error if the WhatsApp web app isn't completely loaded, we wait until the class
wf-loading
is added to the html element so we know the web app is loaded, and the WPP can be injected safely. This should work around the issue #27 while we don't have a final solution from wppconnect.