Add routing for shared sessions and admin pages#64
Merged
JoshuaAFerguson merged 3 commits intoNov 17, 2025
Conversation
…rashes Fixed critical issue where WebSocket event handlers were causing infinite re-render loops, resulting in crashes on multiple pages including: - /shared-sessions - /plugins/catalog - /admin/quotas - /admin/plugins - /admin/scaling Changes: 1. useEnterpriseWebSocket.ts: - Modified useWebSocketEvent hook to use refs for handler storage - Prevents effect re-execution when handler function reference changes - Maintains same pattern as parent useEnterpriseWebSocket hook 2. SharedSessions.tsx: - Changed setSessions to use callback form - Removed 'sessions' from useCallback dependency array - Prevents WebSocket reconnection loop Root cause: Handler functions were recreated on every render, triggering the useEffect dependency array, causing state updates and re-renders in an infinite loop. Fixes WebSocket connection stability and page navigation crashes.
… refresh impact Replaced aggressive reconnection strategy with gradual backoff pattern to prevent constant UI refreshes when WebSocket connections fail. New backoff pattern: - 1st retry: 30 seconds after initial connection failure - 2nd retry: 15 seconds after 1st retry (45s total) - 3rd retry: 15 seconds after 2nd retry (60s total) - 4th+ retries: 60 seconds for all subsequent attempts Changes: 1. useEnterpriseWebSocket.ts: - Added getReconnectDelay() function with custom backoff logic - Replaced fixed 3s interval with delay calculation - Removed reconnectInterval from connect() dependencies - Added console logging for better reconnection visibility 2. useWebSocket.ts: - Added same getReconnectDelay() function - Replaced exponential backoff with custom pattern - Removed reconnectInterval from connect() dependencies - Standardized console logging format Benefits: - Reduces UI churn from frequent reconnection attempts - Gives backend/network time to recover before retrying - Maintains connection resilience with eventual 60s steady-state - Provides clear visibility into reconnection timing via console This prevents the UI refresh issues caused by rapid reconnection attempts while maintaining reliable WebSocket connectivity.
…ays across navigation Fixed issue where users were re-prompted about WebSocket errors after navigating between pages. The dismissed state now persists across page navigation using localStorage. Changes: 1. WebSocketErrorBoundary.tsx: - Added WS_ERROR_DISMISSED_KEY constant for localStorage key - Initialize dismissed state from localStorage in constructor - Persist dismissed state to localStorage when user clicks "Continue Without Live Updates" - Prevents re-prompting on every page navigation 2. EnhancedWebSocketStatus.tsx: - Updated getReconnectDelay() to match WebSocket hook pattern - Changed from exponential backoff (2^n) to custom pattern: 30s, 15s, 15s, 60s - Ensures UI countdown matches actual reconnection timing - Provides consistent UX across WebSocket status indicator and actual reconnections Benefits: - User only needs to dismiss WebSocket error dialog once per session - Dismissed state persists across all page navigations - UI countdown accurately reflects actual reconnection attempts - Consistent reconnection timing throughout the application This improves UX by not repeatedly interrupting the user with the same error dialog as they navigate between pages.
| onOpen, | ||
| autoReconnect = true, | ||
| reconnectInterval = 3000, | ||
| reconnectInterval = 3000, // Not used with custom backoff |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 7 months ago
To fix the problem, remove the reconnectInterval variable from the destructured assignment in the useEnterpriseWebSocket options (lines 37-45). No other references or usages exist, so no other code changes are needed. The related comment ("// Not used with custom backoff") may also be safely removed, as it becomes irrelevant once the variable is gone. Ensure that surrounding commas and code remain syntactically correct after the removal.
Suggested changeset
1
ui/src/hooks/useEnterpriseWebSocket.ts
| @@ -40,7 +40,6 @@ | ||
| onClose, | ||
| onOpen, | ||
| autoReconnect = true, | ||
| reconnectInterval = 3000, // Not used with custom backoff | ||
| maxReconnectAttempts = 10, | ||
| } = options; | ||
|
|
Copilot is powered by AI and may make mistakes. Always verify output.
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.
No description provided.