From 8e8d5cfff07c02cb174801ccf813363b0cd658ca Mon Sep 17 00:00:00 2001 From: ameer Date: Sat, 2 May 2026 23:03:17 +0800 Subject: [PATCH] fix(room): replay reveal payloads to students reconnecting mid-state Students joining or reconnecting while the session is in question_closed or finished previously got only a 'state' broadcast and nothing else, leaving the SPA stuck on whatever was rendered before (typically the join form's disabled state). Now send_student_snapshot replays the question_closed message (and on finished, the session_ended payload) so the SPA can render the reveal or final card immediately. Mirrors the instructor-side reconnect fix in 22d1096. --- app/room.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/room.py b/app/room.py index 0f2863a..60f119d 100644 --- a/app/room.py +++ b/app/room.py @@ -267,6 +267,17 @@ class RoomManager: ack = await self.existing_submit_ack(sid, identity["student_id"], session["current_question_idx"]) if ack: await websocket.send_json(ack) + elif session["state"] == "question_closed": + # Replay the reveal so a student joining mid-reveal sees the + # closed-question card with their answer / correct option / + # leaderboard, instead of being stuck on the join form's + # disabled state waiting for an event that never arrives. + await websocket.send_json(await self.question_open_message(sid, session["current_question_idx"])) + await websocket.send_json( + await self.question_closed_message(sid, session["current_question_idx"], identity) + ) + elif session["state"] == "finished": + await websocket.send_json(await self.ended_message(sid, identity)) async def send_instructor_snapshot(self, websocket: WebSocket, sid: str) -> None: session = await self.get_session(sid)