Bug: Incomplete logout leaves UI stuck in authenticated state when channel is missing or access is denied in ChatHeader.js
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 25/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- javascript, react
- Bereich
- frontend
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 170
- Forks
- 397
- Ø Merge
- 12 T. 14 Std.
- Gemergte PRs (30 T.)
- 6
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus RocketChat/EmbeddedChat
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
RocketChat/EmbeddedChat#1429 ·
Maintainer antworten meist innerhalb von 1 Tag
-
docs: README says Node 22 is required, but .nvmrc pins v24 and preinstall enforces itEvtl. vergeben @Veerpratapgupta hat das vor 29 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
RocketChat/EmbeddedChat#1377 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
test: isMessageSequential in layout_editor has no coverageEvtl. wieder frei Ein Pull Request dazu wurde ohne Merge geschlossen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
RocketChat/EmbeddedChat#1373 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Permissions change-detection in useFetchChatData is dead — applyPermissions re-runs on every callEvtl. vergeben @yash113gadia hat das vor 166 Tagen übernommen. Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
RocketChat/EmbeddedChat#1317 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Only the last emoji shortname in a message is converted to unicodeEvtl. vergeben @yash113gadia hat das vor 167 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
RocketChat/EmbeddedChat#1315 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in RocketChat/EmbeddedChat
Ähnliche Issues
-
Out of order / duplicate key error shows the key bytes as decimal or UTF-8, not hexEvtl. vergeben @bardrop hat das heute übernommen. Offen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 86/100
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 80/100
Maintainer antworten meist innerhalb von 3 Tagen
-
`remix-hook-form/middleware` imports `unstable_createContext`, breaking on `react-router` >= 7.9.0Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
code-forge-io/remix-hook-form#189 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100