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.modern.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect, useMemo, useCallback } from 'react';
|
|
1
|
+
import React, { useState, useEffect, useRef, useMemo, useCallback } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
4
|
function _arrayLikeToArray(r, a) {
|
|
@@ -1041,7 +1041,7 @@ JSChessEngine.getGameResult = function (state, linesWithCheck, activeColor, reve
|
|
|
1041
1041
|
});
|
|
1042
1042
|
var countsSumResult = countsNextMoves.reduce(function (prevValue, curentValue) {
|
|
1043
1043
|
return prevValue + curentValue;
|
|
1044
|
-
});
|
|
1044
|
+
}, 0);
|
|
1045
1045
|
if (linesWithCheck.length > 0 && countsSumResult === 0) return {
|
|
1046
1046
|
resultType: 'mat',
|
|
1047
1047
|
winColor: activeColor === 'white' ? 'black' : 'white'
|
|
@@ -2380,13 +2380,16 @@ var useChessBoardInteractive = function useChessBoardInteractive(props) {
|
|
|
2380
2380
|
var clearArrows = function clearArrows() {
|
|
2381
2381
|
return setArrowsCoords([]);
|
|
2382
2382
|
};
|
|
2383
|
+
var firstRender = useRef(false);
|
|
2383
2384
|
useEffect(function () {
|
|
2384
2385
|
setBoardConfig(getChessBoardConfig(config));
|
|
2385
2386
|
}, []);
|
|
2386
2387
|
useEffect(function () {
|
|
2387
|
-
if (
|
|
2388
|
+
if (firstRender.current) {
|
|
2388
2389
|
var gameResult = JSChessEngine.getGameResult(actualState, linesWithCheck, currentColor, boardReversed);
|
|
2389
2390
|
if (gameResult) onEndGame(gameResult);
|
|
2391
|
+
} else {
|
|
2392
|
+
firstRender.current = true;
|
|
2390
2393
|
}
|
|
2391
2394
|
}, [actualState, linesWithCheck, boardReversed, currentColor]);
|
|
2392
2395
|
var cleanAllForFigure = function cleanAllForFigure() {
|