fixed stale state closure bug by using useRef() in ChessGameContextProvider

This commit is contained in:
Moon Patel
2023-07-28 04:24:16 +05:30
parent 95fb999747
commit e98c50d25d
4 changed files with 134 additions and 36 deletions
+1 -1
View File
@@ -79,7 +79,7 @@ function socketIOServerInit(server) {
// io.to(roomID).emit("new user joined the room");
console.log(data, "joined");
let room = getRoom(roomID);
io.to(roomID).emit(USER_JOINED_ROOM, data.username);
socket.to(roomID).emit(USER_JOINED_ROOM, data.username);
socket.emit(result, room.gameHistory); // room joined successfully
} else {
socket.emit(result); // room is full