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

Đang mở Phù hợp với người mới
#7,098 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@deepak0x đang làm issue này rồi.

Từ ngày 13/4/2026.

  • #7144 của @deepak0x — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
react-native, typescript
Lĩnh vực
mobile

Hướng nghiên cứu

Bắt đầu trong app/lib/methods/helpers/goRoom.ts, đặc biệt là khối catch ở các dòng 111–113 và phần điều hướng ở các dòng 121–129, sau đó kiểm tra search.ts:157 để hiểu rid của kết quả. Đảm bảo việc tạo DM bị lỗi hoặc không thành công không đi đến điều hướng RoomView, và xác minh rằng cả hai nhánh lỗi đều giữ người dùng ở màn hình tìm kiếm.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

type: bug

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)

Ngôn ngữ chính
TypeScript
Star
2.4k
Fork
1.5k
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
29

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của RocketChat/Rocket.Chat.ReactNative

Tất cả issue của RocketChat/Rocket.Chat.ReactNative

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.