RocketChat / RocketChat/Rocket.Chat.ReactNative
bug: goRoom navigates to broken RoomView after failed DM creation from search
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 1.5k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 90
Description
In app/lib/methods/helpers/goRoom.ts, when a user taps a spotlight search result to open a DM and createDirectMessage fails (network error, invalid user, etc.), the catch block at lines 111–113 emits an error toast but does not return. Execution falls through to lines 121–129, which navigates to RoomView with the search item's rid — which is the username string (set by search.ts:157 as rid: user.username), not a real Rocket.Chat room ID.
The result: the user sees an error toast AND gets navigated to a broken/empty RoomView that can't load any room data.
There's a second trigger: if createDirectMessage succeeds but returns { success: false } (or result.room._id is falsy), the try block exits without returning, and the same fallthrough occurs.
Steps to Reproduce
- Open the app, go to the rooms list
- Tap the search icon and search for a username
- Simulate a failure condition (e.g., airplane mode, or search for a user that doesn't exist on the server but appears in spotlight)
- Tap the user result to open a DM
createDirectMessagefails → error toast appears- Observe: app navigates to a broken/empty RoomView instead of staying on the search screen
Expected Behavior
After a failed DM creation, the user should stay on the current screen. The error toast from emitErrorCreateDirectMessage is sufficient feedback. No navigation should occur.
Actual Behavior
The error toast is shown, but execution falls through past the catch block. The app navigates to RoomView with rid set to the username string (e.g., "john"). RoomView tries to load a room with this invalid rid from WatermelonDB, finds nothing, and shows a blank/broken screen.
Rocket.Chat Server Version
Not applicable — client-side bug
Rocket.Chat App Version
Latest develop branch
Device Name
Any
OS Version
Any (iOS and Android)
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/lib/methods/helpers/goRoom.ts, especially the catch block at lines 111–113 and the navigation at lines 121–129, then inspect search.ts:157 to understand the result rid. Ensure failed or unsuccessful DM creation does not reach RoomView navigation, and verify both error paths keep the user on the search screen.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100