From 9246e658551db85d888de963e955fd3237fdfb4f Mon Sep 17 00:00:00 2001 From: pvanwamelen Date: Sat, 21 Dec 2024 16:54:25 -0500 Subject: [PATCH 1/6] Attempt to fix a bug with exploration being lost when the opponent moves and you are either Refreshing your game or using Next Game. --- src/components/GameMove.js | 62 ++++++++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/src/components/GameMove.js b/src/components/GameMove.js index 116c7ec..8c7cd23 100644 --- a/src/components/GameMove.js +++ b/src/components/GameMove.js @@ -477,21 +477,32 @@ function fixMoveOutcomes(exploration, moveNumber) { } // after you submit a move, move the subtree of that explored move to the actual move. -function mergeExistingExploration(moveNum, cur_exploration, exploration) { +function mergeExistingExploration(moveNum, cur_exploration, exploration, game = undefined, useSameMove = false) { let subtree = undefined; moveNum++; while (true) { let move = exploration[moveNum].move .toLowerCase() .replace(/\s+/g, ""); - subtree = cur_exploration.children.find( - (e) => e.move.toLowerCase().replace(/\s+/g, "") === move - ); + let subtree; + if (useSameMove) { + let gameEngine = GameFactory(game.metaGame, exploration[moveNum - 1].state); + subtree = cur_exploration.children.find( + (e) => gameEngine.sameMove(move, e.move) + ); + } else { + subtree = cur_exploration.children.find( + (e) => e.move.toLowerCase().replace(/\s+/g, "") === move + ); + } if (subtree !== undefined) { moveNum++; if (moveNum === exploration.length) { exploration[exploration.length - 1].children = subtree.children; + // TODO: Don't we need to save the exploration to DB here? In particular if a whole bunch of auto moves were triggered. Also if + // we save here, then we only need to fetch the previous move's exploration when the user looks at his game. I think existing exploration after a + // set of auto moves will be lost if we don't save. Maybe test with Zola, it can trigger many auto moves near the end of the game. break; } } else { @@ -1449,7 +1460,15 @@ function GameMove(props) { errorSetter(true); } } - fetchData(); + + // Don't fetch data if user is refreshing a completed game. No point in fetching the game again, the only thing that could have changed is public exploration + if (!(explorationRef.current.gameID === gameID && game && game.gameOver)) { + fetchData(); + } + if (focus?.canExplore) { + // If you are refreshing your game, but there is no new data, exploration won't be fetched, but maybe you are exploring on 2 devices and you would like to see the update here... + explorationFetchedSetter(false); + } }, [ gameID, metaGame, @@ -1532,7 +1551,14 @@ function GameMove(props) { useEffect(() => { if (dbgame !== null) { // Make sure explorationRef is still for the current game (this DOES change e.g. when you click on Next Game) - const exploration = (explorationRef.current && explorationRef.current.gameID === dbgame.id) ? explorationRef.current.nodes : null; + let exploration = null; + if (explorationRef.current !== null) { + if (explorationRef.current.gameID === dbgame.id) { + exploration = explorationRef.current.nodes; + } else { + explorationFetchedSetter(false); + } + } const foc = cloneDeep(focus); const game = dbgame; setupGame( @@ -1554,18 +1580,22 @@ function GameMove(props) { navigate ); if (exploration !== null) { - let ok = explorationRef.current.nodes.length === exploration.length; - for (let i = 0; ok && i < explorationRef.current.nodes.length; i++) { - if (exploration[i].state !== explorationRef.current.nodes[i].state) { - ok = false; - break; + if (explorationRef.current.nodes.length === exploration.length) { + let ok = true; + for (let i = 0; ok && i < explorationRef.current.nodes.length; i++) { + if (exploration[i].state !== explorationRef.current.nodes[i].state) { + ok = false; + } } - } - if (ok) { - for (let i = 0; i < explorationRef.current.nodes.length; i++) { - explorationRef.current.nodes[i].children = exploration[i].children; + if (ok) { + for (let i = 0; i < explorationRef.current.nodes.length; i++) { + explorationRef.current.nodes[i].children = exploration[i].children; + } + handleGameMoveClick(foc); } - handleGameMoveClick(foc); + } else if (explorationRef.current.nodes.length === exploration.length + 1) { + // page refreshed and opponent moved + mergeExistingExploration(exploration.length - 1, exploration[exploration.length - 1], explorationRef.current.nodes, gameRef.current, true); } } processNewSettings( From 763335723c504e5ef85ad7d9c6a486019844d00a Mon Sep 17 00:00:00 2001 From: pvanwamelen Date: Sat, 21 Dec 2024 17:59:30 -0500 Subject: [PATCH 2/6] Revert "Attempt to fix a bug with exploration being lost when the opponent moves and you are either Refreshing your game or using Next Game." This reverts commit 9246e658551db85d888de963e955fd3237fdfb4f. --- src/components/GameMove.js | 62 ++++++++++---------------------------- 1 file changed, 16 insertions(+), 46 deletions(-) diff --git a/src/components/GameMove.js b/src/components/GameMove.js index 8c7cd23..116c7ec 100644 --- a/src/components/GameMove.js +++ b/src/components/GameMove.js @@ -477,32 +477,21 @@ function fixMoveOutcomes(exploration, moveNumber) { } // after you submit a move, move the subtree of that explored move to the actual move. -function mergeExistingExploration(moveNum, cur_exploration, exploration, game = undefined, useSameMove = false) { +function mergeExistingExploration(moveNum, cur_exploration, exploration) { let subtree = undefined; moveNum++; while (true) { let move = exploration[moveNum].move .toLowerCase() .replace(/\s+/g, ""); - let subtree; - if (useSameMove) { - let gameEngine = GameFactory(game.metaGame, exploration[moveNum - 1].state); - subtree = cur_exploration.children.find( - (e) => gameEngine.sameMove(move, e.move) - ); - } else { - subtree = cur_exploration.children.find( - (e) => e.move.toLowerCase().replace(/\s+/g, "") === move - ); - } + subtree = cur_exploration.children.find( + (e) => e.move.toLowerCase().replace(/\s+/g, "") === move + ); if (subtree !== undefined) { moveNum++; if (moveNum === exploration.length) { exploration[exploration.length - 1].children = subtree.children; - // TODO: Don't we need to save the exploration to DB here? In particular if a whole bunch of auto moves were triggered. Also if - // we save here, then we only need to fetch the previous move's exploration when the user looks at his game. I think existing exploration after a - // set of auto moves will be lost if we don't save. Maybe test with Zola, it can trigger many auto moves near the end of the game. break; } } else { @@ -1460,15 +1449,7 @@ function GameMove(props) { errorSetter(true); } } - - // Don't fetch data if user is refreshing a completed game. No point in fetching the game again, the only thing that could have changed is public exploration - if (!(explorationRef.current.gameID === gameID && game && game.gameOver)) { - fetchData(); - } - if (focus?.canExplore) { - // If you are refreshing your game, but there is no new data, exploration won't be fetched, but maybe you are exploring on 2 devices and you would like to see the update here... - explorationFetchedSetter(false); - } + fetchData(); }, [ gameID, metaGame, @@ -1551,14 +1532,7 @@ function GameMove(props) { useEffect(() => { if (dbgame !== null) { // Make sure explorationRef is still for the current game (this DOES change e.g. when you click on Next Game) - let exploration = null; - if (explorationRef.current !== null) { - if (explorationRef.current.gameID === dbgame.id) { - exploration = explorationRef.current.nodes; - } else { - explorationFetchedSetter(false); - } - } + const exploration = (explorationRef.current && explorationRef.current.gameID === dbgame.id) ? explorationRef.current.nodes : null; const foc = cloneDeep(focus); const game = dbgame; setupGame( @@ -1580,22 +1554,18 @@ function GameMove(props) { navigate ); if (exploration !== null) { - if (explorationRef.current.nodes.length === exploration.length) { - let ok = true; - for (let i = 0; ok && i < explorationRef.current.nodes.length; i++) { - if (exploration[i].state !== explorationRef.current.nodes[i].state) { - ok = false; - } + let ok = explorationRef.current.nodes.length === exploration.length; + for (let i = 0; ok && i < explorationRef.current.nodes.length; i++) { + if (exploration[i].state !== explorationRef.current.nodes[i].state) { + ok = false; + break; } - if (ok) { - for (let i = 0; i < explorationRef.current.nodes.length; i++) { - explorationRef.current.nodes[i].children = exploration[i].children; - } - handleGameMoveClick(foc); + } + if (ok) { + for (let i = 0; i < explorationRef.current.nodes.length; i++) { + explorationRef.current.nodes[i].children = exploration[i].children; } - } else if (explorationRef.current.nodes.length === exploration.length + 1) { - // page refreshed and opponent moved - mergeExistingExploration(exploration.length - 1, exploration[exploration.length - 1], explorationRef.current.nodes, gameRef.current, true); + handleGameMoveClick(foc); } } processNewSettings( From c68f817d67d2f4e8cb534d11f8101f03f4ce08b7 Mon Sep 17 00:00:00 2001 From: pvanwamelen Date: Sun, 22 Dec 2024 10:02:39 -0500 Subject: [PATCH 3/6] Let's try again --- src/components/GameMove.js | 66 ++++++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/src/components/GameMove.js b/src/components/GameMove.js index 116c7ec..1819e15 100644 --- a/src/components/GameMove.js +++ b/src/components/GameMove.js @@ -366,6 +366,7 @@ function mergeExploration( ); } } else if (data[2] && data[2].move === moveNumber - 2) { + console.log("Merging 2 moves back"); let node = exploration[moveNumber - 2]; let gameEngine = GameFactory(game.metaGame, node.state); // subtree of the move I chose @@ -477,21 +478,32 @@ function fixMoveOutcomes(exploration, moveNumber) { } // after you submit a move, move the subtree of that explored move to the actual move. -function mergeExistingExploration(moveNum, cur_exploration, exploration) { +function mergeExistingExploration(moveNum, cur_exploration, exploration, game = undefined, useSameMove = false) { let subtree = undefined; moveNum++; while (true) { let move = exploration[moveNum].move .toLowerCase() .replace(/\s+/g, ""); - subtree = cur_exploration.children.find( - (e) => e.move.toLowerCase().replace(/\s+/g, "") === move - ); + let subtree; + if (useSameMove) { + let gameEngine = GameFactory(game.metaGame, exploration[moveNum - 1].state); + subtree = cur_exploration.children.find( + (e) => gameEngine.sameMove(move, e.move) + ); + } else { + subtree = cur_exploration.children.find( + (e) => e.move.toLowerCase().replace(/\s+/g, "") === move + ); + } if (subtree !== undefined) { moveNum++; if (moveNum === exploration.length) { exploration[exploration.length - 1].children = subtree.children; + // TODO: Don't we need to save the exploration to DB here? In particular if a whole bunch of auto moves were triggered. Also if + // we save here, then we only need to fetch the previous move's exploration when the user looks at his game. I think existing exploration after a + // set of auto moves will be lost if we don't save. Maybe test with Zola, it can trigger many auto moves near the end of the game. break; } } else { @@ -1449,7 +1461,15 @@ function GameMove(props) { errorSetter(true); } } - fetchData(); + + // Don't fetch data if user is refreshing a completed game. No point in fetching the game again, the only thing that could have changed is public exploration + if (explorationRef.current.gameID === gameID && game && game.gameOver) { + if (focus?.canExplore) { + explorationFetchedSetter(false); + } + } else { + fetchData(); + } }, [ gameID, metaGame, @@ -1532,7 +1552,14 @@ function GameMove(props) { useEffect(() => { if (dbgame !== null) { // Make sure explorationRef is still for the current game (this DOES change e.g. when you click on Next Game) - const exploration = (explorationRef.current && explorationRef.current.gameID === dbgame.id) ? explorationRef.current.nodes : null; + let exploration = null; + if (explorationRef.current !== null) { + if (explorationRef.current.gameID === dbgame.id) { + exploration = explorationRef.current.nodes; + } else { + explorationFetchedSetter(false); + } + } const foc = cloneDeep(focus); const game = dbgame; setupGame( @@ -1554,18 +1581,24 @@ function GameMove(props) { navigate ); if (exploration !== null) { - let ok = explorationRef.current.nodes.length === exploration.length; - for (let i = 0; ok && i < explorationRef.current.nodes.length; i++) { - if (exploration[i].state !== explorationRef.current.nodes[i].state) { - ok = false; - break; + if (explorationRef.current.nodes.length === exploration.length) { + let ok = true; + for (let i = 0; ok && i < explorationRef.current.nodes.length; i++) { + if (exploration[i].state !== explorationRef.current.nodes[i].state) { + ok = false; + } } - } - if (ok) { - for (let i = 0; i < explorationRef.current.nodes.length; i++) { - explorationRef.current.nodes[i].children = exploration[i].children; + if (ok) { + for (let i = 0; i < explorationRef.current.nodes.length; i++) { + explorationRef.current.nodes[i].children = exploration[i].children; + } + handleGameMoveClick(foc); } - handleGameMoveClick(foc); + // if we got here from the "trigger a refresh" button, we should probably also fetch exploration in case the user is exploring on more than one device + explorationFetchedSetter(false); + } else if (explorationRef.current.nodes.length === exploration.length + 1) { + // page refreshed and opponent moved + mergeExistingExploration(exploration.length - 1, exploration[exploration.length - 1], explorationRef.current.nodes, gameRef.current, true); } } processNewSettings( @@ -1799,7 +1832,6 @@ function GameMove(props) { async function fetchPublicExploration() { explorationFetchedSetter(true); - console.log("fetching public exploration"); var url = new URL(API_ENDPOINT_OPEN); url.searchParams.append("query", "get_public_exploration"); url.searchParams.append("game", gameID); From 415ca1b2b0e0b0b9351381d675fdd31e183e09b5 Mon Sep 17 00:00:00 2001 From: pvanwamelen Date: Sun, 22 Dec 2024 11:25:26 -0500 Subject: [PATCH 4/6] Nope! This reverts commit c68f817d67d2f4e8cb534d11f8101f03f4ce08b7. --- src/components/GameMove.js | 66 ++++++++++---------------------------- 1 file changed, 17 insertions(+), 49 deletions(-) diff --git a/src/components/GameMove.js b/src/components/GameMove.js index 1819e15..116c7ec 100644 --- a/src/components/GameMove.js +++ b/src/components/GameMove.js @@ -366,7 +366,6 @@ function mergeExploration( ); } } else if (data[2] && data[2].move === moveNumber - 2) { - console.log("Merging 2 moves back"); let node = exploration[moveNumber - 2]; let gameEngine = GameFactory(game.metaGame, node.state); // subtree of the move I chose @@ -478,32 +477,21 @@ function fixMoveOutcomes(exploration, moveNumber) { } // after you submit a move, move the subtree of that explored move to the actual move. -function mergeExistingExploration(moveNum, cur_exploration, exploration, game = undefined, useSameMove = false) { +function mergeExistingExploration(moveNum, cur_exploration, exploration) { let subtree = undefined; moveNum++; while (true) { let move = exploration[moveNum].move .toLowerCase() .replace(/\s+/g, ""); - let subtree; - if (useSameMove) { - let gameEngine = GameFactory(game.metaGame, exploration[moveNum - 1].state); - subtree = cur_exploration.children.find( - (e) => gameEngine.sameMove(move, e.move) - ); - } else { - subtree = cur_exploration.children.find( - (e) => e.move.toLowerCase().replace(/\s+/g, "") === move - ); - } + subtree = cur_exploration.children.find( + (e) => e.move.toLowerCase().replace(/\s+/g, "") === move + ); if (subtree !== undefined) { moveNum++; if (moveNum === exploration.length) { exploration[exploration.length - 1].children = subtree.children; - // TODO: Don't we need to save the exploration to DB here? In particular if a whole bunch of auto moves were triggered. Also if - // we save here, then we only need to fetch the previous move's exploration when the user looks at his game. I think existing exploration after a - // set of auto moves will be lost if we don't save. Maybe test with Zola, it can trigger many auto moves near the end of the game. break; } } else { @@ -1461,15 +1449,7 @@ function GameMove(props) { errorSetter(true); } } - - // Don't fetch data if user is refreshing a completed game. No point in fetching the game again, the only thing that could have changed is public exploration - if (explorationRef.current.gameID === gameID && game && game.gameOver) { - if (focus?.canExplore) { - explorationFetchedSetter(false); - } - } else { - fetchData(); - } + fetchData(); }, [ gameID, metaGame, @@ -1552,14 +1532,7 @@ function GameMove(props) { useEffect(() => { if (dbgame !== null) { // Make sure explorationRef is still for the current game (this DOES change e.g. when you click on Next Game) - let exploration = null; - if (explorationRef.current !== null) { - if (explorationRef.current.gameID === dbgame.id) { - exploration = explorationRef.current.nodes; - } else { - explorationFetchedSetter(false); - } - } + const exploration = (explorationRef.current && explorationRef.current.gameID === dbgame.id) ? explorationRef.current.nodes : null; const foc = cloneDeep(focus); const game = dbgame; setupGame( @@ -1581,24 +1554,18 @@ function GameMove(props) { navigate ); if (exploration !== null) { - if (explorationRef.current.nodes.length === exploration.length) { - let ok = true; - for (let i = 0; ok && i < explorationRef.current.nodes.length; i++) { - if (exploration[i].state !== explorationRef.current.nodes[i].state) { - ok = false; - } + let ok = explorationRef.current.nodes.length === exploration.length; + for (let i = 0; ok && i < explorationRef.current.nodes.length; i++) { + if (exploration[i].state !== explorationRef.current.nodes[i].state) { + ok = false; + break; } - if (ok) { - for (let i = 0; i < explorationRef.current.nodes.length; i++) { - explorationRef.current.nodes[i].children = exploration[i].children; - } - handleGameMoveClick(foc); + } + if (ok) { + for (let i = 0; i < explorationRef.current.nodes.length; i++) { + explorationRef.current.nodes[i].children = exploration[i].children; } - // if we got here from the "trigger a refresh" button, we should probably also fetch exploration in case the user is exploring on more than one device - explorationFetchedSetter(false); - } else if (explorationRef.current.nodes.length === exploration.length + 1) { - // page refreshed and opponent moved - mergeExistingExploration(exploration.length - 1, exploration[exploration.length - 1], explorationRef.current.nodes, gameRef.current, true); + handleGameMoveClick(foc); } } processNewSettings( @@ -1832,6 +1799,7 @@ function GameMove(props) { async function fetchPublicExploration() { explorationFetchedSetter(true); + console.log("fetching public exploration"); var url = new URL(API_ENDPOINT_OPEN); url.searchParams.append("query", "get_public_exploration"); url.searchParams.append("game", gameID); From e967f76a24540b76e43b01b2d72a6369955389eb Mon Sep 17 00:00:00 2001 From: pvanwamelen Date: Wed, 25 Dec 2024 13:59:43 -0500 Subject: [PATCH 5/6] And again --- src/components/GameMove.js | 59 +++++++++++++++++++++++--------- src/components/Me/MyTurnTable.js | 2 +- src/pages/Skeleton.js | 4 +-- 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/src/components/GameMove.js b/src/components/GameMove.js index 116c7ec..5933176 100644 --- a/src/components/GameMove.js +++ b/src/components/GameMove.js @@ -366,6 +366,7 @@ function mergeExploration( ); } } else if (data[2] && data[2].move === moveNumber - 2) { + console.log("Merging 2 moves back"); let node = exploration[moveNumber - 2]; let gameEngine = GameFactory(game.metaGame, node.state); // subtree of the move I chose @@ -477,21 +478,31 @@ function fixMoveOutcomes(exploration, moveNumber) { } // after you submit a move, move the subtree of that explored move to the actual move. -function mergeExistingExploration(moveNum, cur_exploration, exploration) { - let subtree = undefined; +function mergeExistingExploration(moveNum, cur_exploration, exploration, game = undefined, useSameMove = false) { moveNum++; while (true) { let move = exploration[moveNum].move .toLowerCase() .replace(/\s+/g, ""); - subtree = cur_exploration.children.find( - (e) => e.move.toLowerCase().replace(/\s+/g, "") === move - ); + let subtree; + if (useSameMove) { + let gameEngine = GameFactory(game.metaGame, exploration[moveNum - 1].state); + subtree = cur_exploration.children.find( + (e) => gameEngine.sameMove(move, e.move) + ); + } else { + subtree = cur_exploration.children.find( + (e) => e.move.toLowerCase().replace(/\s+/g, "") === move + ); + } if (subtree !== undefined) { moveNum++; if (moveNum === exploration.length) { exploration[exploration.length - 1].children = subtree.children; + // TODO: Don't we need to save the exploration to DB here? In particular if a whole bunch of auto moves were triggered. Also if + // we save here, then we only need to fetch the previous move's exploration when the user looks at his game. I think existing exploration after a + // set of auto moves will be lost if we don't save. Maybe test with Zola, it can trigger many auto moves near the end of the game. break; } } else { @@ -1449,7 +1460,15 @@ function GameMove(props) { errorSetter(true); } } - fetchData(); + + // Don't fetch data if user is refreshing a completed game. No point in fetching the game again, the only thing that could have changed is public exploration + if (explorationRef.current.gameID === gameID && game && game.gameOver) { + if (focus?.canExplore) { + explorationFetchedSetter(false); + } + } else { + fetchData(); + } }, [ gameID, metaGame, @@ -1531,7 +1550,7 @@ function GameMove(props) { useEffect(() => { if (dbgame !== null) { - // Make sure explorationRef is still for the current game (this DOES change e.g. when you click on Next Game) + // I don't think the gameID check is still needed, but better safe than sorry const exploration = (explorationRef.current && explorationRef.current.gameID === dbgame.id) ? explorationRef.current.nodes : null; const foc = cloneDeep(focus); const game = dbgame; @@ -1554,18 +1573,24 @@ function GameMove(props) { navigate ); if (exploration !== null) { - let ok = explorationRef.current.nodes.length === exploration.length; - for (let i = 0; ok && i < explorationRef.current.nodes.length; i++) { - if (exploration[i].state !== explorationRef.current.nodes[i].state) { - ok = false; - break; + if (explorationRef.current.nodes.length === exploration.length) { + let ok = true; + for (let i = 0; ok && i < explorationRef.current.nodes.length; i++) { + if (exploration[i].state !== explorationRef.current.nodes[i].state) { + ok = false; + } } - } - if (ok) { - for (let i = 0; i < explorationRef.current.nodes.length; i++) { - explorationRef.current.nodes[i].children = exploration[i].children; + if (ok) { + for (let i = 0; i < explorationRef.current.nodes.length; i++) { + explorationRef.current.nodes[i].children = exploration[i].children; + } + handleGameMoveClick(foc); } - handleGameMoveClick(foc); + // if we got here from the "trigger a refresh" button, we should probably also fetch exploration in case the user is exploring on more than one device + explorationFetchedSetter(false); + } else if (explorationRef.current.nodes.length === exploration.length + 1) { + // page refreshed and opponent moved + mergeExistingExploration(exploration.length - 1, exploration[exploration.length - 1], explorationRef.current.nodes, gameRef.current, true); } } processNewSettings( diff --git a/src/components/Me/MyTurnTable.js b/src/components/Me/MyTurnTable.js index 81f52f8..8968ab2 100644 --- a/src/components/Me/MyTurnTable.js +++ b/src/components/Me/MyTurnTable.js @@ -146,7 +146,7 @@ function MyTurnTable({ games, fetching }) { columnHelper.accessor("timeRemaining", { header: "Time remaining", cell: (props) => ( - + {showMilliseconds(props.getValue())} ), diff --git a/src/pages/Skeleton.js b/src/pages/Skeleton.js index da0cfd0..1cab1ca 100644 --- a/src/pages/Skeleton.js +++ b/src/pages/Skeleton.js @@ -19,7 +19,7 @@ import { import { Amplify, Auth } from "aws-amplify"; import Spinner from "../components/Spinner"; import Welcome from "./Welcome"; -import GameMove from "../components/GameMove"; +import GameMoveWrapper from "../components/GameMoveWrapper"; import About from "../components/About"; import StandingChallenges from "../components/StandingChallenges"; import ListGames from "../components/ListGames"; @@ -263,7 +263,7 @@ function Bones(props) { } /> } + element={} /> Date: Wed, 25 Dec 2024 14:02:08 -0500 Subject: [PATCH 6/6] But do include all files... --- src/components/GameMoveWrapper.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/components/GameMoveWrapper.js diff --git a/src/components/GameMoveWrapper.js b/src/components/GameMoveWrapper.js new file mode 100644 index 0000000..a75c504 --- /dev/null +++ b/src/components/GameMoveWrapper.js @@ -0,0 +1,10 @@ +import { useParams } from 'react-router-dom'; +import GameMove from './GameMove'; + +// A wrapper that is used to remount GameMove in case metaGame or gameID changes (e.g. when we navigate to GameMove when user clicks on "Next Game") +function GameMoveWrapper() { + const params = useParams(); + return ; +} + +export default GameMoveWrapper;