Fixed party joining
This commit is contained in:
parent
d231d9340e
commit
3fc8c98862
@ -27,13 +27,11 @@ function Game() {
|
|||||||
const { databaseStatus } = useContext(DatabaseContext);
|
const { databaseStatus } = useContext(DatabaseContext);
|
||||||
|
|
||||||
const [session] = useState(new Session());
|
const [session] = useState(new Session());
|
||||||
const [offline, setOffline] = useState(false);
|
const [offline, setOffline] = useState();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function connect() {
|
async function connect() {
|
||||||
await session.connect();
|
await session.connect();
|
||||||
if (session.state === "offline") {
|
setOffline(session.state === "offline");
|
||||||
setOffline(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
connect();
|
connect();
|
||||||
}, [session]);
|
}, [session]);
|
||||||
@ -96,7 +94,7 @@ function Game() {
|
|||||||
if (session.state === "online" && databaseStatus !== "loading") {
|
if (session.state === "online" && databaseStatus !== "loading") {
|
||||||
session.joinParty(gameId, password);
|
session.joinParty(gameId, password);
|
||||||
}
|
}
|
||||||
}, [gameId, password, databaseStatus, session]);
|
}, [gameId, password, databaseStatus, session, offline]);
|
||||||
|
|
||||||
// A ref to the Konva stage
|
// A ref to the Konva stage
|
||||||
// the ref will be assigned in the MapInteraction component
|
// the ref will be assigned in the MapInteraction component
|
||||||
|
Loading…
Reference in New Issue
Block a user