RocketChat / RocketChat/Rocket.Chat.ReactNative
bug: [Android] Push notification tap ignored when WebSocket is reconnecting on app foreground
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 1.5k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 90
Description
Describe the Bug
On Android, when a user taps a push notification while the app is backgrounded and the WebSocket has disconnected, the app opens but does not navigate to the relevant room. The notification tap is silently ignored.
The notification data is correctly stored in SharedPreferences by the native Android layer (PushNotificationModule), but the only JS code that reads it — checkPendingNotification() in app/sagas/state.js — is gated behind meteor.connected. Since the WebSocket is still reconnecting at the moment the app foregrounds, the early return at if (!isReady) { return; } is hit and checkPendingNotification() is never called.
There is no fallback — checkPendingNotification() is called in exactly one place in the entire codebase. The notification data remains in SharedPreferences until the next time the user backgrounds and re-foregrounds the app with an active WebSocket connection. If a second notification tap occurs in the meantime, the first notification is permanently overwritten and lost.
This is Android-only. iOS uses Expo's addNotificationResponseReceivedListener which has no WebSocket dependency.
Steps to Reproduce
- Log in to the app on a physical Android device
- Background the app and wait 3–5 minutes for the WebSocket to disconnect (or enable battery optimization / restrict background activity for the app in device settings)
- From another account, send a message to trigger a push notification
- Tap the push notification from the notification shade
- The app opens but remains on the last visited screen — no navigation to the room
Expected Behavior
Tapping a push notification should always navigate the user to the relevant room, regardless of the current WebSocket connection state at the moment of foregrounding.
Actual Behavior
The app opens but does not navigate to the room. The notification tap is silently dropped because checkPendingNotification() in app/sagas/state.js is never reached due to the isAuthAndConnected() guard returning false while the WebSocket is reconnecting.
Rocket.Chat Server Version
NA
Rocket.Chat App Version
NA
Device Name
NA
OS Version
NA
Additional Context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in app/sagas/state.js by tracing the isAuthAndConnected() guard and the sole call to checkPendingNotification(). Read how the native Android PushNotificationModule stores pending data in SharedPreferences. Done means an Android notification tap still navigates to the relevant room while the WebSocket is reconnecting, without losing a subsequent pending notification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, react-native, typescript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100