Problems when someone leaves or join

Hi, I’m developing a React applicaction with Redux as state container based on the “openvidu-call-react” example but some times things go weird when someone leaves/join the room: the nicknames of the peers are exchanged or the video or audio freeze.

PS: Even I had to set the sesssion “vidu.initSession()” to global var usin window.viduSession to call the window.viduSession.disconnect() when the beforeunload event is fired.