fix(socketio): data inconsistence

This commit is contained in:
Leandro Antônio Farias Machado 2023-06-18 22:34:18 -03:00
parent 742fcc9d3c
commit 10b9b4776b
2 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ export const WsContext = createContext({ undefined });
export const WsProvider = (props) => {
const { children } = props;
const [users, setUsers] = useState([])
const [users, setUsers] = useState(null)
const auth = useAuth()
const initialize = async () => {
// Prevent from calling twice in development mode with React.StrictMode enable
@ -19,7 +19,7 @@ export const WsProvider = (props) => {
socket.on("users", (data) => {
setUsers(data)
console.log("data received from users event: ", users)
console.log("data received from users event: ", data)
})
socket.emit("newuser",{

View File

@ -119,7 +119,7 @@ const Page = () => {
}
}
return(ws.users.length > 1 ?
return(ws.users ?
<Box
component="main"
sx={{