Skip to content

Commit

Permalink
Fix alt display change exploration
Browse files Browse the repository at this point in the history
  • Loading branch information
pvanwamelen committed Nov 28, 2024
1 parent 45ec65b commit 82972b0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/components/GameMove.js
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,8 @@ function GameMove(props) {

useEffect(() => {
if (dbgame !== null) {
const exploration = explorationRef.current;
const foc = cloneDeep(focus);
const game = dbgame;
setupGame(
game,
Expand All @@ -1550,6 +1552,18 @@ function GameMove(props) {
globalMe?.settings?.[game.metaGame]?.display,
navigate
);
if (exploration !== null) {
for (let i = 0; i < explorationRef.current.length; i++) {
// The following checks might be overkill, but I'm not sure about all the cases that might trigger this useEffect.
// I mostly want to copy exploration for the case where the display settings were changed (which changes globalMe which triggers this useEffect).
if (exploration[i] && explorationRef.current[i].move === exploration[i].move && explorationRef.current[i].toMove === exploration[i].toMove) {
explorationRef.current[i].children = exploration[i].children;
} else {
break;
}
}
handleGameMoveClick(foc);
}
processNewSettings(
gameRef.current.me > -1
? game.players.find((p) => p.id === globalMe.id).settings
Expand Down
2 changes: 2 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -406,11 +406,13 @@ th .player {
.playerImage {
height: 0.8rem;
width: 0.8rem;
min-width: 0.8rem;
}

.toMoveImage {
height: 1.15rem;
width: 1.15rem;
min-width: 1.15rem;
}

/* Colours the "board state" indicator */
Expand Down

0 comments on commit 82972b0

Please sign in to comment.