Skip to content

[GUI] WebSocket onopen handler set after connection established #56

@Vantalens

Description

@Vantalens

File: packages/gui/src/App.tsx:161

Severity: High

Description:
wsRef.current.onopen set after connectRunEvents returns; if WebSocket connects immediately (localhost), onopen never fires and setConnected(true) is missed.

Failure Scenario:
Localhost WebSocket connects synchronously → onopen fires before line 161 executes → GUI shows 'offline' despite working connection → user sees red status indicator but everything works.

Code:

wsRef.current = client.connectRunEvents(...);
// ... other setup
wsRef.current.onopen = () => setConnected(true); // TOO LATE!

Suggested Fix:
Set onopen handler inside connectRunEvents before creating WebSocket, or rely on onmessage to infer connection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingguiGUI/frontend related issueshigh-priorityHigh priority issuesjavascriptPull requests that update javascript code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions