Sync reconnect manager crashes when the WebSocket global is undefined
️: Sentry LITE-76J / LITE-76G: TypeError: Cannot read properties of undefined (reading 'OPEN') in the sync client's reconnect manager, from the window online and disconnect handlers — ~50 events / ~15 users, Chrome on Windows, since mid-July 2026.
The reconnect manager compares the socket's ready state against the WebSocket.OPEN / WebSocket.CONNECTING static constants on the global WebSocket constructor. In some sessions that global is undefined at the time a network or visibility event fires (likely a browser extension or page teardown), so the comparison itself throws and the reconnect logic crashes. Expected behavior: the reconnect manager should not depend on the global constructor being present when reacting to events — comparing against the numeric ready-state values would let it keep working.
Related: #7894 (making the adapter work outside browsers touches the same global).
Open questions
- Do we want to go further and make the adapter fully independent of the global
WebSocket, or just avoid the static-constant lookups? Awaiting answer.
Confidence: 80%, ready to get started.
Source: tldraw/tldraw