fix : copy game headers too
This commit is contained in:
@@ -37,11 +37,7 @@ export const useChessActions = (chessAtom: PrimitiveAtom<Chess>) => {
|
|||||||
|
|
||||||
const copyGame = useCallback(() => {
|
const copyGame = useCallback(() => {
|
||||||
const newGame = new Chess();
|
const newGame = new Chess();
|
||||||
if (game.history().length > 0) {
|
newGame.loadPgn(game.pgn());
|
||||||
newGame.loadPgn(game.pgn());
|
|
||||||
} else {
|
|
||||||
newGame.load(game.fen());
|
|
||||||
}
|
|
||||||
return newGame;
|
return newGame;
|
||||||
}, [game]);
|
}, [game]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user