fix: Ajustando whatsapp.bailey.service.ts para mostrar corretamente o…#2402
Closed
jpavrdev wants to merge 12 commits into
Closed
fix: Ajustando whatsapp.bailey.service.ts para mostrar corretamente o…#2402jpavrdev wants to merge 12 commits into
jpavrdev wants to merge 12 commits into
Conversation
… QR Code que não estava aparecendo
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts WhatsApp Baileys disconnect handling to avoid an infinite reconnect loop during the initial connection phase so the QR code can be displayed correctly. Sequence diagram for updated WhatsApp Baileys disconnect and reconnect flowsequenceDiagram
actor User
participant WebApp
participant BaileysStartupService
participant WhatsAppServer
User->>WebApp: Open_whatsapp_connection_screen
WebApp->>BaileysStartupService: connectToWhatsapp(phoneNumber)
BaileysStartupService->>WhatsAppServer: initiate_connection
WhatsAppServer-->>BaileysStartupService: connection_update(qr_generated)
BaileysStartupService-->>WebApp: emit_qrcode(qrcode)
WebApp-->>User: display_qrcode
rect rgb(230,230,250)
WhatsAppServer-->>BaileysStartupService: connection_closed(lastDisconnect)
BaileysStartupService->>BaileysStartupService: determine_statusCode
BaileysStartupService->>BaileysStartupService: isInitialConnection = !instance.wuid && instance.qrcode.count == 0
alt initial_connection_and_qr_not_used_yet
BaileysStartupService->>BaileysStartupService: log Initial_connection_closed_wait_for_qr
BaileysStartupService-->>WhatsAppServer: no_reconnect
else subsequent_disconnect_and_shouldReconnect
BaileysStartupService->>BaileysStartupService: shouldReconnect = !codesToNotReconnect.includes(statusCode)
BaileysStartupService->>WhatsAppServer: reconnect_if_shouldReconnect
else disconnect_with_forbidden_or_logged_out
BaileysStartupService->>BaileysStartupService: stop_reconnect
end
end
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts:432` </location>
<code_context>
const shouldReconnect = !codesToNotReconnect.includes(statusCode);
+
+ // Check if this is the initial connection before QR code generation
+ const isInitialConnection = !this.instance.wuid && this.instance.qrcode.count === 0;
+
+ if (isInitialConnection) {
</code_context>
<issue_to_address>
**issue (bug_risk):** Guard against `this.instance.qrcode` being undefined before accessing `.count`.
If `qrcode` isn’t initialized when disconnect runs, this will throw at runtime. Consider a defensive access pattern (e.g. `this.instance.qrcode?.count ?? 0`) so this remains safe during unusual initialization or disconnect sequences.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
…tion Foundation 2026 - Apache 2.0 license with © 2026 Evolution Foundation - Standardized README structure (header, badges, footer) - Unified contact: suporte@evofoundation.com.br - Unified URLs: evolutionfoundation.com.br + docs.evolutionfoundation.com.br - Added/updated NOTICE, TRADEMARKS.md, SECURITY.md, CONTRIBUTING.md - Canonical cover image at public/hover-evolution.png Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…n-foundation Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Member
|
Hi! Quick request before we can merge — this PR's source branch is your fork's
Could you please:
Base branch should target |
Build falhava com TS2304: Cannot find name 'maxRetries' porque o log no
handler de messages.update referenciava ${maxRetries}, mas nenhuma
variável ou loop de retry foi introduzido. Provavelmente regressão do
merge cad92bd com upstream.
Mantém a mensagem do fork sem a interpolação inválida.
fix(baileys): remove dangling maxRetries ref in message-update log
Author
|
Fechando — obsolete (já aplicado em develop). Ver body atualizado. |
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.
O conteúdo deste PR já foi aplicado no
developupstream. Os dois commits do fork (4b802391fix QR Code +a75cdf2csourcery safe-access) e o fix doisInitialConnectionduplicado que eu apliquei no fork também já têm equivalente em develop.Verificação:
Fechando. Vou resetar o
maindo meu fork paraupstream/developem seguida.