fix : infinite rerenders

This commit is contained in:
GuillaumeSD
2024-02-25 03:02:59 +01:00
parent 7412f708d0
commit 2af25cf4ec
11 changed files with 50 additions and 47 deletions

View File

@@ -5,7 +5,7 @@ import { boardAtom, gameAtom } from "../states";
import { useChessActions } from "@/hooks/useChess";
export default function GoToLastPositionButton() {
const boardActions = useChessActions(boardAtom);
const { setPgn: setBoardPgn } = useChessActions(boardAtom);
const game = useAtomValue(gameAtom);
const board = useAtomValue(boardAtom);
@@ -20,7 +20,7 @@ export default function GoToLastPositionButton() {
<IconButton
onClick={() => {
if (isButtonDisabled) return;
boardActions.setPgn(game.pgn());
setBoardPgn(game.pgn());
}}
disabled={isButtonDisabled}
>