From ee207c1d32c8fba52b5528f3646cb0d87e6daa8e Mon Sep 17 00:00:00 2001 From: George Price Date: Tue, 11 Jun 2024 18:08:00 -0400 Subject: [PATCH] fix bugs (#61) * code compiles * explanation * explanation * more descriptive name * michael feedback * bugfix --- client/src/components/lobby/PublicLobbyList.tsx | 14 +++----------- client/src/components/website/ExplanationText.tsx | 12 ++---------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/client/src/components/lobby/PublicLobbyList.tsx b/client/src/components/lobby/PublicLobbyList.tsx index 42d1fd7..9a8f648 100644 --- a/client/src/components/lobby/PublicLobbyList.tsx +++ b/client/src/components/lobby/PublicLobbyList.tsx @@ -29,7 +29,7 @@ export function PublicLobbyList(props: PublicLobbyListProps) { // Ensure that lobby is ready for connections before adding to visible lobby list await isReadyForConnect(appId, lobby.roomId, hathoraSdk); setReadyRooms((prev) => { - return new Set([...prev, l.roomId]); + return new Set([...prev, lobby.roomId]); }); }); }, [lobbies, appId]); @@ -148,20 +148,12 @@ function useLobbies(appId: string): LobbyV3[] { const [lobbies, setLobbies] = React.useState([]); React.useEffect(() => { if (appId) { - hathoraSdk.lobbiesV3.listActivePublicLobbies().then((lobbies) => { - if (lobbies != null) { - setLobbies(lobbies); - } - }); + hathoraSdk.lobbiesV3.listActivePublicLobbies().then(setLobbies); } }, [appId]); useInterval(() => { if (appId) { - hathoraSdk.lobbiesV3.listActivePublicLobbies().then((lobbies) => { - if (lobbies != null) { - setLobbies(lobbies); - } - }); + hathoraSdk.lobbiesV3.listActivePublicLobbies().then(setLobbies); } }, 2000); return lobbies; diff --git a/client/src/components/website/ExplanationText.tsx b/client/src/components/website/ExplanationText.tsx index 6fb9551..acfcf36 100644 --- a/client/src/components/website/ExplanationText.tsx +++ b/client/src/components/website/ExplanationText.tsx @@ -400,20 +400,12 @@ function useLobbies(appId: string): LobbyV3[] { const [lobbies, setLobbies] = React.useState([]); React.useEffect(() => { if (appId) { - hathoraSdk.lobbiesV3.listActivePublicLobbies().then((lobbies) => { - if (lobbies != null) { - setLobbies(lobbies); - } - }); + hathoraSdk.lobbiesV3.listActivePublicLobbies().then(setLobbies); } }, [appId]); useInterval(() => { if (appId) { - hathoraSdk.lobbiesV3.listActivePublicLobbies().then((lobbies) => { - if (lobbies != null) { - setLobbies(lobbies); - } - }); + hathoraSdk.lobbiesV3.listActivePublicLobbies().then(setLobbies); } }, 2000); return lobbies;