Skip to content

Commit 895a86c

Browse files
committed
chore: Fix skips on replays
1 parent 00a0951 commit 895a86c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/web/react/components/othello/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { SerializedInstance } from '@/types/common';
99

1010
export type GameModelAPI = SerializedInstance<Omit<GameModel, 'winCtx'> & { winCtx: Othello['winCtx'] }>;
1111

12-
type OthelloLog = { action: 'play' | 'skip'; time: string; turn: 'W' | 'B'; ctx: [number, number] };
12+
type OthelloLog = { action: 'play' | 'skip'; time: string; turn: 'W' | 'B'; ctx: [number, number] | null };
1313

1414
type Board = (null | 'W' | 'B')[][];
1515
type GameState = { board: Board; sinceLast: number | null; at: Date; score: { W: number; B: number } };
@@ -150,7 +150,7 @@ export const ViewOnlyOthello = memo(({ game }: { game: GameModelAPI }): ReactEle
150150
(boards, entry) => {
151151
const lastState = boards.at(-1)!;
152152
const nextBoard = cloneBoard(lastState.board);
153-
playOnBoard(nextBoard, entry.turn, ...entry.ctx);
153+
if (entry.action === 'play') playOnBoard(nextBoard, entry.turn, ...entry.ctx!);
154154
const playedAt = new Date(entry.time);
155155
const nextState: GameState = {
156156
board: nextBoard,

0 commit comments

Comments
 (0)