fix: show finished games on watch page instead of hanging spinner #16

Merged
lq64 merged 1 commits from fix-finished-games into main 2026-06-29 09:47:41 +02:00
Owner

Summary

▎ - Opening a finished game caused an infinite spinner because the NDJSON stream never delivers events for finished games — it just hangs waiting for events that will never come
▎ - Fix: fetch the full game state via REST on load (GET .../game/{gameId}), apply it to the board immediately, and only open the stream subscription if the game is still ongoing or pending

▎ Changes

▎ - tournament-watch.component.ts — REST fetch now drives the initial state; stream is only started conditionally; extracted applySnapshot(), isFinished(), subscribeToStream()

▎ Test plan

▎ - [ ] Finished game: board shows final position, correct status label, no spinner
▎ - [ ] Live game: board shows current position, stream updates continue to work
▎ - [ ] Pending game: stream starts and updates once the game begins

Summary ▎ ▎ - Opening a finished game caused an infinite spinner because the NDJSON stream never delivers events for finished games — it just hangs waiting for events that will never come ▎ - Fix: fetch the full game state via REST on load (GET .../game/{gameId}), apply it to the board immediately, and only open the stream subscription if the game is still ongoing or pending ▎ ▎ Changes ▎ ▎ - tournament-watch.component.ts — REST fetch now drives the initial state; stream is only started conditionally; extracted applySnapshot(), isFinished(), subscribeToStream() ▎ ▎ Test plan ▎ ▎ - [ ] Finished game: board shows final position, correct status label, no spinner ▎ - [ ] Live game: board shows current position, stream updates continue to work ▎ - [ ] Pending game: stream starts and updates once the game begins
lq64 added 1 commit 2026-06-28 19:55:21 +02:00
Previously, navigating to a finished game caused the watch page to spin
forever because the stream never delivers events for finished games.

Fix by fetching the full game state via REST on load (GET .../game/{gameId}),
applying it immediately to the board, and only starting the stream subscription
if the game is still ongoing or pending.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
lq64 merged commit 828c2a03c1 into main 2026-06-29 09:47:41 +02:00
lq64 deleted branch fix-finished-games 2026-06-29 09:47:43 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NowChess/NowChess-Frontend#16