fix(android): check pending notification before WebSocket connection guard#7048
Open
deepak0x wants to merge 1 commit intoRocketChat:developfrom
Open
fix(android): check pending notification before WebSocket connection guard#7048deepak0x wants to merge 1 commit intoRocketChat:developfrom
deepak0x wants to merge 1 commit intoRocketChat:developfrom
Conversation
…guard When tapping a push notification while WebSocket is reconnecting, the app opens but does not navigate to the room. This happens because checkPendingNotification() was gated behind isAuthAndConnected(), which requires meteor.connected === true. During reconnection, this check returns false and the notification tap is silently ignored. Fix: Move checkPendingNotification() before the connection guard. This is safe because it dispatches deepLinkingOpen, and the deepLinking saga already waits for LOGIN.SUCCESS before navigating to the room. Fixes RocketChat#7013
Contributor
WalkthroughA bug fix that reorders the notification check in the foreground handler to execute before connection verification, enabling Android push notifications to be processed even when the WebSocket is still reconnecting. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
eb2683a to
ff38eb0
Compare
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.
Proposed changes
On Android, when a user taps a push notification while the WebSocket is reconnecting, the app opens but does not navigate to the room. The notification tap is silently ignored.
Root cause:
checkPendingNotification()inapp/sagas/state.jswas called inside theisAuthAndConnected()guard, which requiresmeteor.connected === true. During WebSocket reconnection, this returnsfalse, so the function is never reached and the pending notification data in SharedPreferences is never processed.Fix: Move
checkPendingNotification()before theisAuthAndConnected()guard. This is safe because:checkPendingNotification()dispatches adeepLinkingOpenRedux actiondeepLinkingsaga already has its ownyield take(LOGIN.SUCCESS)mechanism to wait for reconnection before navigatingThis is a minimal, targeted fix that leverages the existing reconnection-wait pattern used throughout the codebase.
Issue(s)
Fixes #7013
How to test or reproduce
Types of changes
Checklist
Further comments
The
deepLinking.jssaga (which handlesdeepLinkingOpenactions) already correctly waits forLOGIN.SUCCESSbefore navigating to a room (see lines 172-178). By callingcheckPendingNotification()before the connection guard, we ensure notification data is read from SharedPreferences and dispatched to the deep linking saga, which handles the reconnection wait.Summary by CodeRabbit