diff --git a/src/components/PgnViewer.tsx b/src/components/PgnViewer.tsx index ca8dac6..3d6e50c 100644 --- a/src/components/PgnViewer.tsx +++ b/src/components/PgnViewer.tsx @@ -20,7 +20,7 @@ const PgnViewer = ({ gamePgn, handlePlyChange }: IProps) => { scrollToMove: false, }); - // set initial position - TODO change onto file load + // set initial position - TODO change to on file load // handlePlyChange({ // ply: 0, // fen: viewerRef.current?.curData().fen, @@ -78,7 +78,7 @@ const PgnViewer = ({ gamePgn, handlePlyChange }: IProps) => { move.removeEventListener("touchstart", clickHandlerDelay); }); }; - }, [gamePgn]); + }, [gamePgn, handlePlyChange]); return
; }; diff --git a/src/hooks/useChessGame.ts b/src/hooks/useChessGame.ts index 83b20d1..7c34c40 100644 --- a/src/hooks/useChessGame.ts +++ b/src/hooks/useChessGame.ts @@ -1,4 +1,10 @@ -import { type ChangeEvent, useReducer, useRef, useState } from "react"; +import { + type ChangeEvent, + useCallback, + useReducer, + useRef, + useState, +} from "react"; import type { IPosition } from "#/interfaces.ts"; import { gameReducer, initialGameState } from "#/reducers/gameReducer.ts"; import { downloadPDF } from "#/utils/pdfUtils.ts"; @@ -17,9 +23,9 @@ export const useChessGame = () => { const fileInputRef = useRef