fix: persist active_remote_id in state for remote session restore
Remote sessions failed to reconnect after page refresh because restoreState() and renderSheetList() didn't pass remoteId to openSession(). Fix: - state.py: add active_remote_id field to empty_state() - main.py: extend StatePatch model to accept active_session and active_remote_id; update PATCH /api/state to selectively update only fields explicitly provided (using model_fields_set) - app.js restoreState(): read state.active_remote_id and pass it as remoteId option so page-refresh reconnects remote sessions - app.js openSession(): fire-and-forget PATCH /api/state to persist active_session + active_remote_id after successful connect - app.js closeSession(): fire-and-forget PATCH /api/state to clear both fields so refresh doesn't try to reopen a closed session - app.js renderSheetList(): add data-remote-id to sheet items and pass remoteId in click handler (previously called openSession(name) with no remoteId, routing remote sessions to local 404 endpoint) Fixes: POST /api/sessions/paperclip-adapter/connect 404 when clicking a remote session from the mobile bottom sheet or after page refresh.
This commit is contained in:
@@ -59,6 +59,7 @@ def empty_state() -> dict:
|
||||
"""
|
||||
return {
|
||||
"active_session": None,
|
||||
"active_remote_id": None,
|
||||
"session_order": [],
|
||||
"sessions": {},
|
||||
"devices": {},
|
||||
|
||||
Reference in New Issue
Block a user