Feat: Improve session navigation, state handling, and connection management#191
Merged
Conversation
- Introduces reset functionality for session-scoped state during transitions. - Utilizes `enterSession()` for cleaner session code navigation and session teardown. - Replaces URL fragment navigation with `routerLink`
- Added handling for session join failures with UI feedback. - Improved WebRTC connection management for smoother chat experience. - Optimized chat member monitoring for better performance. - Updated Arabic translations to support new error messages. - Enhanced session navigation with fallback to public rooms.
- Updated `openssl` to version 0.10.79 and `openssl-sys` to 0.9.115.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves chat session transitions by centralizing session teardown/re-init in ChatComponent, strengthening WebRTC peer cleanup when members depart, and shifting some navigations (privacy + session open/end) toward SPA routing to reduce full page reloads.
Changes:
- Added a session transition pipeline (
enterSession) and updated route handling to reset session-scoped state when the session code changes. - Improved WebRTC cleanup by introducing
closeConnection(targetUser)and clearing more per-peer/per-session signaling state. - Updated UI navigation and error handling (routerLink for privacy, join-failure fallback messaging, new i18n strings).
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| client/web/src/app/features/chat/components/chat-sidebar/chat-sidebar.component.html | Switched Privacy link to SPA navigation via routerLink. |
| client/web/src/app/features/chat/chat.component.ts | Added enterSession transition logic, updated member subscription behavior, improved connect/fallback handling, and adjusted session open/end flows. |
| client/web/src/app/features/chat/chat.component.html | Switched Privacy link to SPA navigation via routerLink. |
| client/web/src/app/core/services/room-management/room.service.ts | Added reset() to clear session-scoped room/member state. |
| client/web/src/app/core/services/communication/websocket-connection.service.ts | Removed a toast on initial websocket error (leaving UI handling to caller). |
| client/web/src/app/core/services/communication/webrtc.service.ts | Added closeConnection() API delegating to signaling. |
| client/web/src/app/core/services/communication/webrtc-signaling.service.ts | Implemented per-peer cleanup (closeConnection) and expanded full cleanup to clear additional maps/timeouts. |
| client/web/src/app/core/interfaces/webrtc.interface.ts | Extended interface with closeConnection(targetUser). |
| client/web/src/app/core/i18n/localizations/en.json | Added SESSION_JOIN_FAILED string. |
| client/web/src/app/core/i18n/localizations/ar.json | Added Arabic translation for SESSION_JOIN_FAILED. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Settle the establishConnection() promise from onclose when the socket closes before opening (e.g. concurrent disconnect or abrupt server-side close), so callers waiting on connect() never hang. - Track a monotonic transition id in enterSession() so a stale transition finishing late after a newer one started doesn't toast, navigate, or reset isNavigatingIntentionally on behalf of the active session. - short verbose comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant improvements to session management, WebRTC connection handling, and user experience during session transitions in the chat application. The main focus is on ensuring that all session-scoped state is properly reset when switching between sessions, that WebRTC connections are robustly cleaned up when members leave, and that navigation between sessions is seamless and reliable. Additionally, several minor enhancements and bug fixes are included.
Session management and navigation improvements:
enterSessionmethod toChatComponentthat centralizes teardown and re-initialization of all session-scoped state when the session code changes, ensuring clean transitions between public and private sessions.paramMapsubscription to distinguish between initial bootstrap and in-app navigation, triggeringenterSessiononly on actual session changes after the first load. [1] [2]WebRTC connection cleanup and reliability:
closeConnection(targetUser: string)to the WebRTC service and signaling service, which fully cleans up all state, timeouts, and message queues for a departed peer, preventing resource leaks and stale connections. [1] [2] [3]closeAllConnectionsand related cleanup methods to clear additional internal maps and state, ensuring no stale data persists between sessions.User experience and UI updates:
en.json,ar.json) to add a new error message for session join failures. [1] [2]chat.component.htmlto use Angular'srouterLinkfor SPA navigation.Performance and correctness enhancements:
combineLatestand RxJS operators for efficient updates, and to avoid unnecessary re-renders or connection attempts for the local user.resetmethod toRoomServiceto clear all session-scoped state on session transitions.Bug fixes:
These changes collectively make session transitions more reliable, reduce the risk of stale or leaking resources, and improve the user experience during navigation between chat sessions.