hex-tower: solo Resign finishes state but never flips viewPhase / match-end #1027

Closed
opened 2026-08-12 09:17:06 +00:00 by spikerj · 1 comment
Owner

Summary

LocalMatchClient only invokes onPhaseTransition from the Tick loop when a Tick produces phase === "finished". Resign (and any other dispatch that finishes the match) updates reducer state via emit() but never calls onPhaseTransition.

Impact

Solo resign leaves HexTowerDefenceComponent.viewPhase on "playing" while state.phase is already "finished", so the finished HUD / activity match-end track never run.

Expected

Any transition into finished (Tick or Resign / defeat via action) should notify onPhaseTransition once.

Repro (unit)

hex-tower-defence.match-hud.spec.ts — "solo resign finishes reducer state but leaves viewPhase on playing".

Suggested fix

In LocalMatchClient.dispatch (or after emit), if next.phase === "finished" && !finishedNotified, set the flag and call onPhaseTransition?.(next).

## Summary `LocalMatchClient` only invokes `onPhaseTransition` from the Tick loop when a Tick produces `phase === "finished"`. Resign (and any other `dispatch` that finishes the match) updates reducer state via `emit()` but never calls `onPhaseTransition`. ## Impact Solo resign leaves `HexTowerDefenceComponent.viewPhase` on `"playing"` while `state.phase` is already `"finished"`, so the finished HUD / activity `match-end` track never run. ## Expected Any transition into `finished` (Tick **or** Resign / defeat via action) should notify `onPhaseTransition` once. ## Repro (unit) `hex-tower-defence.match-hud.spec.ts` — "solo resign finishes reducer state but leaves viewPhase on playing". ## Suggested fix In `LocalMatchClient.dispatch` (or after emit), if `next.phase === "finished" && !finishedNotified`, set the flag and call `onPhaseTransition?.(next)`.
Author
Owner

Already present on spikersoft-angular master. LocalMatchClient.dispatch notifies onPhaseTransition when Resign (or any action) moves the match to finished, so solo resign flips viewPhase and runs match-end. Closing.

Already present on `spikersoft-angular` `master`. `LocalMatchClient.dispatch` notifies `onPhaseTransition` when Resign (or any action) moves the match to `finished`, so solo resign flips `viewPhase` and runs match-end. Closing.
Sign in to join this conversation.