niklabh / mattermost-plugin-webrtc-video

A webrtc video call plugin for mattermost
Apache License 2.0
84 stars 17 forks source link

this.connectToSwarm() could get called before this.setState() updated the state #45

Open nimaje opened 3 years ago

nimaje commented 3 years ago

as this.setState() only requests an state change(0) the following this.connectToSwarm()(1) could be called before this.state is updated, this will lead to problems if the assumtion here is that this.state is updated in this.connectToSwarm()

0: https://reactjs.org/docs/react-component.html#setstate 1: https://github.com/niklabh/mattermost-plugin-webrtc-video/blob/e3513a33a52de9c2b84f1d98d400c6d7a702b17a/webapp/src/components/modals/audio_group_call/audio_group_call.jsx#L97