fix(terminal): loading state, focus handling, debug logging
- Initialize loading=true in useTerminalSessions to prevent auto-create from firing before initial load completes - Remove hasAutoCreated ref from TerminalPage (no longer needed) - Add focus() to TerminalRef, call on tab switch - Add term.focus() after term.open() in TerminalComponent - Add console logging for WebSocket send/receive to debug no-i/o - Revert backend _read_loop retry logic to original break-on-error
This commit is contained in:
@@ -254,7 +254,6 @@ async def _handle_terminal_websocket(
|
||||
|
||||
async def _read_loop(session_ref: SessionRef, websocket) -> None:
|
||||
"""Read output from the container and send to WebSocket."""
|
||||
send_failures = 0
|
||||
try:
|
||||
while True:
|
||||
session = session_ref.session
|
||||
@@ -265,15 +264,10 @@ async def _read_loop(session_ref: SessionRef, websocket) -> None:
|
||||
if data:
|
||||
try:
|
||||
await websocket.send_bytes(data)
|
||||
send_failures = 0
|
||||
except WebSocketDisconnect:
|
||||
break
|
||||
except Exception:
|
||||
# Send failed — client may have disconnected.
|
||||
# Allow a few retries before giving up so transient
|
||||
# errors don't kill the whole session.
|
||||
send_failures += 1
|
||||
if send_failures >= 3:
|
||||
break
|
||||
await asyncio.sleep(0.1)
|
||||
break
|
||||
else:
|
||||
await asyncio.sleep(0.01)
|
||||
except Exception:
|
||||
|
||||
Reference in New Issue
Block a user