Files
gomoku/client
tiennm99 23a15765be fix(client): harden scene teardown to prevent PVP→PVE residue
Defensive cleanup to address the reported symptom "can not play PVE
after PVP". Server-side flow tests pass in every permutation, so the
residue must be in the client scene lifecycle.

game-state-service:
- Reset isSpectating on GAME_STARTING, not just on CLIENT_EXIT. If a
  prior watch session ever left the flag set (e.g., the user left via
  a path that didn't emit CLIENT_EXIT), a fresh game-starting signal
  would incorrectly treat the new player as a spectator and block
  clicks via isMyTurn() returning false.

game-scene._cleanup:
- Explicitly drop Phaser input listeners (pointerdown, pointermove).
  Phaser's scene shutdown is supposed to tear down the input plugin,
  but an explicit off() makes the cleanup obvious and robust against
  any lifecycle quirk in scene restart.
- Null out this.board / this.stones / this.lastMarker / this.hoverGraphic
  / this.hoverPos so the next create() starts from a known-clean state,
  and late-firing events can't accidentally dereference stale Phaser
  game objects that the scene already destroyed.

No functional change to the happy path — just defensive teardown that
makes a scene restart observably idempotent.

npm run build green.
2026-04-11 18:53:23 +07:00
..