diff --git a/client/src/App.js b/client/src/App.js index 794c0d6..d1d9c33 100755 --- a/client/src/App.js +++ b/client/src/App.js @@ -215,7 +215,7 @@ const App = () => { return ( - } path={`${base}/games/:gameId`}/> + } path={`${base}/:gameId`}/> } path={`${base}`}/> diff --git a/client/src/Board.js b/client/src/Board.js index fd6be4d..167b498 100644 --- a/client/src/Board.js +++ b/client/src/Board.js @@ -27,7 +27,7 @@ const Board = () => { const [ longestRoadLength, setLongestRoadLength ] = useState(0); const fields = useMemo(() => [ 'signature', 'robber', 'robberName', - 'pips', 'pipsOrder', 'borders', 'borderOrder', 'tiles', 'tileOrder', + 'pips', 'pipOrder', 'borders', 'borderOrder', 'tiles', 'tileOrder', 'placements', 'turn', 'state', 'color', 'longestRoadLength' ], []); @@ -100,6 +100,9 @@ const Board = () => { } const onResize = debounce(() => { + if (!board.current) { + return; + } /* Adjust the 'transform: scale' for the BoardBox * so the board fills the Board * @@ -122,7 +125,7 @@ const Board = () => { window.addEventListener('resize', onResize); onResize(); - + return () => { window.removeEventListener('resize', onResize); } @@ -487,12 +490,14 @@ const Board = () => { setTileElements(generateTiles()); setCornerElements(generateCorners()); setRoadElements(generateRoads()); - }, [signature, - setPipElements, setBorderElements, setTileElements, - setCornerElements, setRoadElements, - borderImageWidth, radius, tileHalfHeight, tileHalfWidth, - borderImageHeight, borderOrder, borders, pipOrder, pips, robber, tileOrder, tiles, - tileHeight]); + }, [ + signature, + setPipElements, setBorderElements, setTileElements, + setCornerElements, setRoadElements, + borderImageWidth, radius, tileHalfHeight, tileHalfWidth, tileHeight, + borderImageHeight, + borderOrder, borders, pipOrder, pips, robber, tileOrder, tiles + ]); if (turn) { let nodes = document.querySelectorAll('.Active'); diff --git a/client/src/Common.js b/client/src/Common.js index 3b23d8a..b8f928d 100644 --- a/client/src/Common.js +++ b/client/src/Common.js @@ -24,6 +24,6 @@ function debounce(fn, ms) { const base = process.env.PUBLIC_URL; const assetsPath = `${base}/assets`; -const gamesPath = `${base}/games`; +const gamesPath = `${base}`; export { base, debounce, assetsPath, gamesPath, getPlayerName }; \ No newline at end of file