commenting open matches
This commit is contained in:
@@ -38,24 +38,24 @@ export default function TicTacToe() {
|
||||
});
|
||||
}, [onMatchData]);
|
||||
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
|
||||
async function refreshLoop() {
|
||||
while (active) {
|
||||
const matches = await listOpenMatches();
|
||||
setOpenMatches(matches);
|
||||
|
||||
await new Promise(res => setTimeout(res, 500)); // 0.5s refresh
|
||||
}
|
||||
}
|
||||
|
||||
refreshLoop();
|
||||
|
||||
return () => {
|
||||
active = false;
|
||||
};
|
||||
}, [listOpenMatches]);
|
||||
// useEffect(() => {
|
||||
// let active = true;
|
||||
//
|
||||
// async function refreshLoop() {
|
||||
// while (active) {
|
||||
// const matches = await listOpenMatches();
|
||||
// setOpenMatches(matches);
|
||||
//
|
||||
// await new Promise(res => setTimeout(res, 500)); // 0.5s refresh
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// refreshLoop();
|
||||
//
|
||||
// return () => {
|
||||
// active = false;
|
||||
// };
|
||||
// }, [listOpenMatches]);
|
||||
|
||||
// ------------------------------------------
|
||||
// CONNECT
|
||||
@@ -130,8 +130,8 @@ export default function TicTacToe() {
|
||||
{/* Join matchmaking */}
|
||||
<button onClick={() => startQueue(selectedMode)}>Join Matchmaking</button>
|
||||
|
||||
{/* List open matches */}
|
||||
<MatchList matches={openMatches} />
|
||||
{/*/!* List open matches *!/*/}
|
||||
{/*<MatchList matches={openMatches} />*/}
|
||||
</>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user