react-chessboard-ui 1.4.9 → 1.4.10
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.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +6 -3
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1044,7 +1044,7 @@ JSChessEngine.getGameResult = function (state, linesWithCheck, activeColor, reve
|
|
|
1044
1044
|
});
|
|
1045
1045
|
var countsSumResult = countsNextMoves.reduce(function (prevValue, curentValue) {
|
|
1046
1046
|
return prevValue + curentValue;
|
|
1047
|
-
});
|
|
1047
|
+
}, 0);
|
|
1048
1048
|
if (linesWithCheck.length > 0 && countsSumResult === 0) return {
|
|
1049
1049
|
resultType: 'mat',
|
|
1050
1050
|
winColor: activeColor === 'white' ? 'black' : 'white'
|
|
@@ -2383,13 +2383,16 @@ var useChessBoardInteractive = function useChessBoardInteractive(props) {
|
|
|
2383
2383
|
var clearArrows = function clearArrows() {
|
|
2384
2384
|
return setArrowsCoords([]);
|
|
2385
2385
|
};
|
|
2386
|
+
var firstRender = React.useRef(false);
|
|
2386
2387
|
React.useEffect(function () {
|
|
2387
2388
|
setBoardConfig(getChessBoardConfig(config));
|
|
2388
2389
|
}, []);
|
|
2389
2390
|
React.useEffect(function () {
|
|
2390
|
-
if (
|
|
2391
|
+
if (firstRender.current) {
|
|
2391
2392
|
var gameResult = JSChessEngine.getGameResult(actualState, linesWithCheck, currentColor, boardReversed);
|
|
2392
2393
|
if (gameResult) onEndGame(gameResult);
|
|
2394
|
+
} else {
|
|
2395
|
+
firstRender.current = true;
|
|
2393
2396
|
}
|
|
2394
2397
|
}, [actualState, linesWithCheck, boardReversed, currentColor]);
|
|
2395
2398
|
var cleanAllForFigure = function cleanAllForFigure() {
|