Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change user type comparation on game controller #59

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/pages/game/LobbyRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from "react"
import { addPlayerToGame, listenGame } from "../../services/games-store"
import { getUserInfo } from "../../services/authentication"
import { useNavigate } from "react-router-dom"
import { Game, GameSchema, GameState, StoreResponse } from "../../utils/types"
import { Game, GameSchema, GameState, GameUser, StoreResponse } from "../../utils/types"
import { getSnapshotData } from "../../services/store"
import { LobbySettings } from "./LobbySettings"
import { LobbyPlayers } from "./LobbyPlayers"
Expand All @@ -15,7 +15,7 @@ type LobbyRoomProps = {
}

export const LobbyRoom = (props: LobbyRoomProps) => {
const [users, setUsers] = useState({})
const [users, setUsers] = useState({} as Record<string, GameUser>)
const unsubscribe = useRef(() => {})
const navigate = useNavigate()

Expand All @@ -42,7 +42,7 @@ export const LobbyRoom = (props: LobbyRoomProps) => {

// Update users
if (!isEqual(users, game.users)) {
setUsers(Object.values(game.users))
setUsers({ ...game.users })
}

// Start the game play if the game is ready
Expand Down
Loading