Skip to content

Feat: Improve session navigation, state handling, and connection management#191

Merged
SloMR merged 7 commits into
mainfrom
feat/ImproveNavigation
May 6, 2026
Merged

Feat: Improve session navigation, state handling, and connection management#191
SloMR merged 7 commits into
mainfrom
feat/ImproveNavigation

Conversation

@SloMR
Copy link
Copy Markdown
Owner

@SloMR SloMR commented May 6, 2026

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:

  • Added a robust enterSession method to ChatComponent that centralizes teardown and re-initialization of all session-scoped state when the session code changes, ensuring clean transitions between public and private sessions.
  • Modified the route paramMap subscription to distinguish between initial bootstrap and in-app navigation, triggering enterSession only on actual session changes after the first load. [1] [2]
  • Updated the "End Session" and "Open Session" flows to rely on SPA navigation and the new session management logic, removing redundant teardown code.

WebRTC connection cleanup and reliability:

  • Added 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]
  • Enhanced the member list subscription to detect when members leave, automatically closing WebRTC connections and clearing related state for departed users.
  • Improved closeAllConnections and related cleanup methods to clear additional internal maps and state, ensuring no stale data persists between sessions.

User experience and UI updates:

  • Improved error handling during connection attempts: if joining a private session fails, the app now gracefully falls back to the public session or displays an error toast.
  • Updated localization files (en.json, ar.json) to add a new error message for session join failures. [1] [2]
  • Changed the privacy link in chat.component.html to use Angular's routerLink for SPA navigation.

Performance and correctness enhancements:

  • Updated the member list subscription to use combineLatest and RxJS operators for efficient updates, and to avoid unnecessary re-renders or connection attempts for the local user.
  • Added a reset method to RoomService to clear all session-scoped state on session transitions.

Bug fixes:

  • Fixed an issue where WebRTC connection status updates could occur for users no longer in the room, by checking membership before updating status. [1] [2]
  • Removed a redundant error toast on WebSocket connection failure that could appear during intentional disconnects.

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.

SloMR added 2 commits May 6, 2026 21:57
- 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.
@SloMR SloMR self-assigned this May 6, 2026
Copilot AI review requested due to automatic review settings May 6, 2026 19:16
@SloMR SloMR added this to PastePoint May 6, 2026
@SloMR SloMR added documentation Improvements or additions to documentation enhancement New feature or request typescript Pull requests that update TypeScript code client Changes made for the Client side labels May 6, 2026
@SloMR SloMR moved this to testing in PastePoint May 6, 2026
- Updated `openssl` to version 0.10.79 and `openssl-sys` to 0.9.115.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread client/web/src/app/features/chat/chat.component.html
Comment thread client/web/src/app/features/chat/chat.component.ts Outdated
Comment thread client/web/src/app/features/chat/chat.component.ts Outdated
Copilot AI review requested due to automatic review settings May 6, 2026 19:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 15 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • client/web/package-lock.json: Language not supported

Comment thread client/web/src/app/features/chat/chat.component.ts
- 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
@SloMR SloMR merged commit 001e5e9 into main May 6, 2026
25 checks passed
@SloMR SloMR deleted the feat/ImproveNavigation branch May 6, 2026 19:52
@github-project-automation github-project-automation Bot moved this from testing to done in PastePoint May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client Changes made for the Client side documentation Improvements or additions to documentation enhancement New feature or request typescript Pull requests that update TypeScript code

Projects

Status: done

Development

Successfully merging this pull request may close these issues.

2 participants