Bug: Incomplete logout leaves UI stuck in authenticated state when channel is missing or access is denied in ChatHeader.js
Maintainer thường phản hồi trong vòng 1 ngày
Đá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
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, react
- Lĩnh vực
- frontend
Hướng nghiên cứu
Start in packages/react/src/views/ChatHeader/ChatHeader.js at getChannelInfo (lines 202–288) and compare its two error branches with handleLogout() in the same file, noting which state resets are skipped. Also inspect the unguarded RCInstance.channelInfo() and setMessageAllowed paths. Done means both error branches reach the logout state reset and null/rejected responses are handled; verify by authenticating with a non-existent roomId. A linked open pull request (#1428) already covers this work, so read it before starting.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
In packages/react/src/views/ChatHeader/ChatHeader.js, when getChannelInfo encounters an 'error-room-not-found' or 'Not Allowed' error, it dispatches an error toast ("Logging out") and calls await RCInstance.logout() directly instead of invoking handleLogout().
Because handleLogout() is bypassed:
setIsUserAuthenticated(false)is never called, leaving the React UI permanently stuck in the authenticated view even though the backend session has been terminated.- Stores and UI state (
setMessages([]),setChannelInfo({}),setShowSidebar(false),setUserAvatarUrl(null), andisMessageLoaded) are not reset. - Additionally,
getChannelInfoandsetMessageAllowedlacktry...catchblocks and safe optional chaining (res?.success,res && 'errorType' in res), which can cause an unhandledTypeErrorcrash ifRCInstance.channelInfo()returnsundefinedor rejects on network failure.
Affected File
packages/react/src/views/ChatHeader/ChatHeader.js(lines 202–288)
Steps to Reproduce
- Authenticate into EmbeddedChat configured with a non-existent
roomId(error-room-not-found) or a restricted private room where the user lacks permission (Not Allowed). - Observe the toast message:
"Channel doesn't exist. Logging out."or"You don't have permission to access this channel. Logging out". - Notice that while
RCInstance.logout()runs,isUserAuthenticatedremainstrueand the UI stays stuck in the logged-in state instead of returning to the login state.
Expected Behavior
- Error-triggered logouts in
getChannelInfoshould callawait handleLogout()so thatisUserAuthenticatedis set tofalseand all user/channel/message stores are properly cleared. - Async calls in
getChannelInfoandsetMessageAllowedshould safely guard against null/undefined responses and network rejections.
- Ngôn ngữ chính
- JavaScript
- Star
- 170
- Fork
- 397
- Merge trung bình
- 12 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 6
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của RocketChat/EmbeddedChat
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
RocketChat/EmbeddedChat#1429 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs: README says Node 22 is required, but .nvmrc pins v24 and preinstall enforces itCó thể đã có người làm @Veerpratapgupta đã nhận 29 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
RocketChat/EmbeddedChat#1377 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
test: isMessageSequential in layout_editor has no coverageCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
RocketChat/EmbeddedChat#1373 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Permissions change-detection in useFetchChatData is dead — applyPermissions re-runs on every callCó thể đã có người làm @yash113gadia đã nhận 166 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
RocketChat/EmbeddedChat#1317 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Only the last emoji shortname in a message is converted to unicodeCó thể đã có người làm @yash113gadia đã nhận 166 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
RocketChat/EmbeddedChat#1315 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của RocketChat/EmbeddedChat
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
webtorrent/webtorrent#3131 ·
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
trustjonathan/STUDY-HUB#15 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100