RocketChat / RocketChat/Rocket.Chat.ReactNative

bug: goRoom navigates to broken RoomView after failed DM creation from search

Open Beginner friendly
#7,098 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
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
  1. Open the app, go to the rooms list
  2. Tap the search icon and search for a username
  3. Simulate a failure condition (e.g., airplane mode, or search for a user that doesn't exist on the server but appears in spotlight)
  4. Tap the user result to open a DM
  5. createDirectMessage fails → error toast appears
  6. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.