next-chessground 0.10.2 → 0.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -5956,10 +5956,13 @@ const initial$1 = fen.initial;
5956
5956
 
5957
5957
  const useChess = props => {
5958
5958
  const [fen, setFen] = useState(props.fen || initial$1);
5959
- const [chess$1] = useState(new chess.Chess(fen)); // reinitialize when FEN changes from props
5959
+ const [chess$1, setChess] = useState(new chess.Chess(fen)); // reinitialize when FEN changes from props
5960
5960
 
5961
5961
  useEffect(() => {
5962
- setFen(props.fen);
5962
+ if (props.fen) {
5963
+ setFen(props.fen);
5964
+ setChess(new chess.Chess(props.fen));
5965
+ }
5963
5966
  }, [props.fen]);
5964
5967
  const [lastMove, setLastMove] = useState([]);
5965
5968
  const promotion = props.lastMove && props.lastMove.promotion;
package/dist/index.js CHANGED
@@ -5965,10 +5965,13 @@ const initial$1 = fen.initial;
5965
5965
 
5966
5966
  const useChess = props => {
5967
5967
  const [fen, setFen] = React.useState(props.fen || initial$1);
5968
- const [chess$1] = React.useState(new chess.Chess(fen)); // reinitialize when FEN changes from props
5968
+ const [chess$1, setChess] = React.useState(new chess.Chess(fen)); // reinitialize when FEN changes from props
5969
5969
 
5970
5970
  React.useEffect(() => {
5971
- setFen(props.fen);
5971
+ if (props.fen) {
5972
+ setFen(props.fen);
5973
+ setChess(new chess.Chess(props.fen));
5974
+ }
5972
5975
  }, [props.fen]);
5973
5976
  const [lastMove, setLastMove] = React.useState([]);
5974
5977
  const promotion = props.lastMove && props.lastMove.promotion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-chessground",
3
- "version": "0.10.2",
3
+ "version": "0.10.3",
4
4
  "description": "React and Next wrapper for Chessground with chessboard and pieces out of the box",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",