Bug: Incomplete logout leaves UI stuck in authenticated state when channel is missing or access is denied in ChatHeader.js
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- javascript, react
- 领域
- frontend
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- JavaScript
- 星标
- 170
- 派生
- 397
- 平均合并
- 12 天 14 小时
- 30 天内合并 PR
- 6
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
RocketChat/EmbeddedChat 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
RocketChat/EmbeddedChat#1429 ·
维护者通常 1 天内回复
-
docs: README says Node 22 is required, but .nvmrc pins v24 and preinstall enforces it可能已有人在做 @Veerpratapgupta 于 29 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
RocketChat/EmbeddedChat#1377 · 1 条评论 ·
维护者通常 1 天内回复
-
test: isMessageSequential in layout_editor has no coverage可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
RocketChat/EmbeddedChat#1373 ·
维护者通常 1 天内回复
-
Permissions change-detection in useFetchChatData is dead — applyPermissions re-runs on every call可能已有人在做 @yash113gadia 于 166 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 85/100
RocketChat/EmbeddedChat#1317 ·
维护者通常 1 天内回复
-
Only the last emoji shortname in a message is converted to unicode可能已有人在做 @yash113gadia 于 167 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
RocketChat/EmbeddedChat#1315 ·
维护者通常 1 天内回复
查看 RocketChat/EmbeddedChat 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
webtorrent/webtorrent#3131 ·
-
good first issue
难度 2/5 1-3 小时 新手友好度 88/100
trustjonathan/STUDY-HUB#15 ·
-
难度 1/5 1 小时以内 新手友好度 68/100
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100