Combined fixes: SPA reinject, ciphertext recovery, getContact mutation, cancelPairingCode#53
Closed
Adi1231234 wants to merge 18 commits intoupstream-mainfrom
Closed
Combined fixes: SPA reinject, ciphertext recovery, getContact mutation, cancelPairingCode#53Adi1231234 wants to merge 18 commits intoupstream-mainfrom
Adi1231234 wants to merge 18 commits intoupstream-mainfrom
Conversation
getcontact() and getChatModel() overwrite .id directly on live Backbone model references from WhatsApp Web's Contact/Participant store. This permanently corrupts the store for the lifetime of the session, causing all subsequent lookups for the same contact to crash with: - "Cannot read properties of undefined (reading '_serialized')" - "Data passed to getter must include an id property" the fix resolves LID to phone on the serialized copy only, never touching the live store model. fixes wwebjs#127054
- requestPairingCode() now exposes onCodeReceivedEvent if needed, so it works on clients initialized in QR mode - Add cancelPairingCode() method to stop pairing and return to QR - Update TypeScript definitions
1. Add _injectInProgress concurrency guard 2. Replace polling loops with waitForFunction 3. Deduplicate Backbone listeners via tuple array with cleanup 4. Atomic hasSynced check after listener registration 5. isMainFrame guard and storeAvailable SPA skip in framenavigated co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- try/finally around inject() to always reset _injectInProgress - Atomic hasSynced check inside listener registration evaluate() - Fix framenavigated: capture isLogout before async, skip re-inject only when not logout AND store available - try/catch around obj.off() in listener cleanup - Null guard in QR ref change handler - Reset qrRetries on LOADING_SCREEN event - Add exposeFunctionIfAbsent in requestPairingCode() co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
extract named onRefChange handler so it can be removed via
socket.on('change:hasSynced') once authentication succeeds,
matching PR #41's cleanup behavior.
co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add automatic recovery for ciphertext messages using WhatsApp's built-in PLACEHOLDER_MESSAGE_RESEND (PDO type 4). Override the AB test gate and send recovery requests after a 5s grace period. Also adds message_ciphertext_failed event at 15s and fixes incorrect JSDoc on onAddMessageCiphertextEvent.
businessprofile.find() checks the local cache first and only fetches from the server when the profile is missing, while fetchBizProfile() always makes a network call (~85-100ms per contact). This significantly reduces latency when getContact is called repeatedly for the same business contacts. closes wwebjs#201656 co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…d-upstream' into stable
…o stable Resolved conflict with SPA reinject: kept waitForFunction flow, manually added window.getQR assignment, exposeFunctionIfAbsent in requestPairingCode(), and cancelPairingCode() method.
businessprofile.find() never throws for non-business contacts - it returns a BusinessProfile model with profileOptions: null, not an error. The comment was factually incorrect. The existing profileOptions guard handles the non-business case correctly without any exception handling. verified in WhatsApp Web DevTools: find() returns a valid object for regular, business, LID, and even non-existent contacts. Only throws when called without an id, which cannot happen here. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
#63) * fix: skip message event when ciphertext resolves to revoked when a ciphertext message is revoked before it decrypts, WhatsApp's internal revoke handler calls model.set({ type: 'revoked', ... }) on the existing model in place. This triggers change:type on the ciphertext model, which fired the deferred listener and emitted a spurious message event with type === 'revoked'. add an early return in the once('change:type') callback to skip onaddmessageevent when the resolved type is revoked. fixes wwebjs#201668 * fix: use handlePlaceholderMsgsSeen for ciphertext recovery replace the manual sendPeerDataOperationRequest call with a direct call to handlePlaceholderMsgsSeen. This adds subtype filtering (skips bot_unavailable_fanout, hosted_unavailable_fanout, view_once_unavailable_fanout), an age check (14 day limit via the placeholder_message_resend_maximum_days_limit AB prop), and internal deduplication so the same message doesn't get multiple PDO requests. the true second argument is the 'is visible' flag the function expects. since the gate override is already in place earlier in the evaluate block, the function passes its own internal gate check and proceeds normally. suggested by @sofi-ans in review.
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.
Summary
Upstream PRs