fix: reset relay sockets on visibility change to prevent auth hangs on sleep/wake

When browser tab is hidden (sleep), tear down all relay socket connections
completely. This forces fresh socket creation and clean auth handshake on wake,
preventing stuck AuthStatus.PendingResponse states.

- Add documentVisibility store tracking document.visibilityState
- Call Pool.get().remove(url) for relay sockets during hidden teardown
- Integrate socket reset in syncUserData, syncSpaces, syncDMs
- Add explanatory comments for visibility guards and race conditions

Fixes: App stuck in "Authenticating" after Mac sleep/wake cycle
Tested with: wss://news.utxo.one/
This commit is contained in:
nayan9617
2026-04-07 00:15:39 +05:30
parent 0547e9513f
commit cd40768f1c
7 changed files with 181 additions and 55 deletions
+3
View File
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}