-
Notifications
You must be signed in to change notification settings - Fork 5.4k
fix: Ajustando whatsapp.bailey.service.ts para mostrar corretamente o… #2402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jpavrdev
wants to merge
2
commits into
EvolutionAPI:main
Choose a base branch
from
jpavrdev:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+9
−0
Conversation
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
… 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts
Outdated
Show resolved
Hide resolved
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.
📋 Description
Correção de um problema onde o QR Code não estava aparecendo corretamente.
Foi feito um ajuste no arquivo
whatsapp.bailey.service.tspara garantir a exibição correta do código.🔗 Related Issue
🧪 Type of Change
🧪 Testing
📸 Screenshots (if applicable)
✅ Checklist
Summary by Sourcery
Bug Fixes: