Skip to content

Commit

Permalink
fix() navigation between contract
Browse files Browse the repository at this point in the history
  • Loading branch information
immortal-tofu committed Dec 6, 2023
1 parent 4955f38 commit 551c732
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/modules/game/components/Game/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ export const Game = ({ account, provider }: GameProps) => {
setContractLoading(false);
};

if (!contractLoading && !contract) {
if (!contractLoading && contractAddress) {
setContractLoading(true);
void getContract(contractAddress!);
}
}, [contractAddress]);
}, [contractAddress, provider]);

useEffect(() => {
const refreshPlayers = async () => {
Expand Down
6 changes: 4 additions & 2 deletions src/modules/game/components/WaitingRoom/WaitingRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ export const WaitingRoom = ({ contract, account, players, currentName = '' }: Wa
setMinPlayers(await contract.MIN_PLAYERS());
setMaxPlayers(await contract.MAX_PLAYERS());
};
void refreshInformations();
}, [contract]);
if (account) {
void refreshInformations();
}
}, [contract, account]);

const startGame = async () => {
const startTx = await contract.start();
Expand Down

0 comments on commit 551c732

Please sign in to comment.