diff --git a/packages/play-node-go/src/components/GameUI/Board/Board.js b/packages/play-node-go/src/components/GameUI/Board/Board.js index 1d8f75f..68f357c 100644 --- a/packages/play-node-go/src/components/GameUI/Board/Board.js +++ b/packages/play-node-go/src/components/GameUI/Board/Board.js @@ -3,7 +3,7 @@ import './Board.scss'; import Point from '../Point/Point'; const Board = (props) => { - const { game, user, dispatch, board } = props; + const { game, user, dispatch, board, meta } = props; const sizeFlag = `Game__board--size-${ game.boardSize }` const renderPoints = boardSize => { diff --git a/packages/play-node-go/src/components/GameUI/Point/Point.js b/packages/play-node-go/src/components/GameUI/Point/Point.js index 59de091..ea9351f 100644 --- a/packages/play-node-go/src/components/GameUI/Point/Point.js +++ b/packages/play-node-go/src/components/GameUI/Point/Point.js @@ -2,8 +2,8 @@ import React from 'react'; import './Point.scss'; const Point = (props) => { - const { posX, posY, user, game, dispatch, pointData } = props; - const turn = game.turn > 0 ? 'black' : 'white'; + const { posX, posY, user, game, meta, dispatch, pointData } = props; + const turn = meta && meta.turn ? meta.turn > 0 ? 'black' : 'white' : game.turn > 0 ? 'black' : 'white'; const stone = () => { if (pointData === 1) return 'black' diff --git a/packages/play-node-go/src/pages/Game/Game.js b/packages/play-node-go/src/pages/Game/Game.js index 221f572..32d0210 100644 --- a/packages/play-node-go/src/pages/Game/Game.js +++ b/packages/play-node-go/src/pages/Game/Game.js @@ -39,7 +39,7 @@ const Game = (props) => { return dispatch(action); } roomSocketConnect(); - }, [ state.active.game.open , dispatch, state.user ] ) + }, [ state.active.game, dispatch, state.user ] ) return (
{ { case 'UPDATE_BOARD': const { gameRecord, pass, turn, winner, playerState } = action.body.meta; - return {...state, board: action.body.board, active: { game: {...state.active.game, gameRecord, pass, turn, winner, playerState } } }; + return {...state, board: action.body.board, meta: {gameRecord, pass, turn, winner, playerState } }; case 'SET_ACTIVE': return {...state, active: action.body};