-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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