[codex] Fix initial offline websocket UI state#1748
[codex] Fix initial offline websocket UI state#1748sabraman wants to merge 2 commits intopingdotgg:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
you don't need to be online to have a connection to the backend though? |
ApprovabilityVerdict: Approved Straightforward bug fix for WebSocket connection UI state when the browser starts offline. Changes are limited to UI presentation logic (text labels and icons), include comprehensive tests, and have no runtime behavior implications beyond the intended fix. You can customize Macroscope's approvability policy. Learn more. |
Dismissing prior approval to re-evaluate e24ac5b
yeah, updated this to keep the existing state semantics and instead make the initial blocking UI network-aware |
Summary
Why
The new websocket connection surface already has dedicated offline UI copy, but the state helper only returned
offlineafter a disconnect had already occurred. On a cold launch with the browser offline, the app could show a misleading connecting state instead of the offline surface.Impact
Users who open the web client while already offline now see the correct offline state immediately instead of a connecting message.
Validation
bun run test src/rpc/wsConnectionState.test.tsbun fmtbun lintbun typecheckNote
Fix WebSocket blocking UI to show offline state when browser starts offline
buildBlockingCopywithgetBlockingStateDescriptorinWebSocketConnectionSurface.tsx, adding atoneandconnectionLabelfield to the returned descriptor.connectingUI state when the browser is offline, returningtone: 'offline'and'Waiting for network'labels instead of the generic connecting state.copy.tonerather thanuiStatedirectly.wsConnectionStatestate machine.Macroscope summarized e24ac5b.
Note
Low Risk
Low risk UI/logic refactor limited to the WebSocket connection surface plus added tests; behavior changes only affect what blocking copy/icon is shown when the browser is offline during initial connect.
Overview
Updates the WebSocket blocking surface to use a new exported
getBlockingStateDescriptorthat centralizes the UI copy, connection label, and tone used to select icons/spinner.When
uiStateisconnectingbut the browser is offline, the surface now shows a dedicated “Waiting for network” offline message instead of the standard “Opening WebSocket” copy. Adds regression tests for the new descriptor behavior and expandswsConnectionStatetests around initial offline vs first failed attempt handling.Reviewed by Cursor Bugbot for commit e24ac5b. Bugbot is set up for automated code reviews on this repo. Configure here.