commenting open matches

This commit is contained in:
2025-11-28 16:08:33 +05:30
parent 34e8984daa
commit 5b30ac8d83

View File

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