diff --git a/src/main/client/src/Game.jsx b/src/main/client/src/Game.jsx index da113cf..71f4e5a 100644 --- a/src/main/client/src/Game.jsx +++ b/src/main/client/src/Game.jsx @@ -166,7 +166,7 @@ export const Game = () => { y: cursor_y, }), }) - }, [context, currentPlayer, currentColor, auth, board, gameId, stompClient, counting, forbidden_x, forbidden_y, gameHasEnded]) + }, [context, currentPlayer, currentColor, auth, board, stompClient, counting, forbidden_x, forbidden_y, gameHasEnded, movesLength]) useEffect(() => { if (!board.length) { diff --git a/src/main/client/src/feature/GamePanel.jsx b/src/main/client/src/feature/GamePanel.jsx index d2d5ea7..8288ef4 100644 --- a/src/main/client/src/feature/GamePanel.jsx +++ b/src/main/client/src/feature/GamePanel.jsx @@ -3,7 +3,6 @@ import { useContext, } from "react" import { - useParams, useNavigate, } from "react-router-dom" import { @@ -46,11 +45,11 @@ export const GamePanel = ({zoom, setZoom}) => { } function Panel({zoom, setZoom}) { - let { gameId } = useParams() let stompClient = useContext(StompContext) let auth = useAuthStore(state => state.auth) let black = useGameStore(state => state.black) let white = useGameStore(state => state.white) + let isSelfPlay = black === white let queueLength = useGameStore(state => state.queueLength) let movesLength = useGameStore(state => state.moves.length) let counting = useGameStore(state => state.counting) @@ -71,7 +70,7 @@ function Panel({zoom, setZoom}) { action: "pass", }), }) - }, [stompClient, gameId, movesLength]) + }, [stompClient, movesLength]) let onResetCounting = useCallback(() => { stompClient.publish({ destination: "/app/game/move", @@ -80,7 +79,7 @@ function Panel({zoom, setZoom}) { action: "resetCounting", }), }) - }, [stompClient, gameId, movesLength]) + }, [stompClient, movesLength]) let onCountingAgree = useCallback(() => { setAgreeCounting(true) stompClient.publish({ @@ -90,7 +89,7 @@ function Panel({zoom, setZoom}) { action: "agreeCounting", }), }) - }, [stompClient, gameId, movesLength]) + }, [stompClient, movesLength, setAgreeCounting]) if (!board.length) { return Loading... } @@ -162,7 +161,7 @@ function Panel({zoom, setZoom}) {