Clean up lifecycle methods

auto_join_3.3
Håvar Aambø Fosstveit 2020-05-01 22:04:14 +02:00
parent 87b114fccc
commit 36b7e45f05
3 changed files with 24 additions and 25 deletions

View File

@ -172,27 +172,21 @@ class Filmstrip extends React.PureComponent
window.removeEventListener('resize', this.updateDimensions);
}
componentWillUpdate(nextProps)
{
if (nextProps !== this.props)
{
if (
nextProps.activeSpeakerId != null &&
nextProps.activeSpeakerId !== this.props.myId
)
{
// eslint-disable-next-line react/no-did-update-set-state
this.setState({
lastSpeaker : nextProps.activeSpeakerId
});
}
}
}
componentDidUpdate(prevProps)
{
if (prevProps !== this.props)
{
if (
this.props.activeSpeakerId != null &&
this.props.activeSpeakerId !== this.props.myId
)
{
// eslint-disable-next-line react/no-did-update-set-state
this.setState({
lastSpeaker : this.props.activeSpeakerId
});
}
this.updateDimensions();
}
}

View File

@ -31,13 +31,15 @@ export default class PeerAudio extends React.PureComponent
this._setOutputDevice(audioOutputDevice);
}
// eslint-disable-next-line camelcase
UNSAFE_componentWillReceiveProps(nextProps)
componentDidUpdate(prevProps)
{
const { audioTrack, audioOutputDevice } = nextProps;
if (prevProps !== this.props)
{
const { audioTrack, audioOutputDevice } = this.props;
this._setTrack(audioTrack);
this._setOutputDevice(audioOutputDevice);
this._setTrack(audioTrack);
this._setOutputDevice(audioOutputDevice);
}
}
_setTrack(audioTrack)

View File

@ -345,11 +345,14 @@ class VideoView extends React.PureComponent
}
}
componentWillUpdate()
componentDidUpdate(prevProps)
{
const { videoTrack, audioTrack } = this.props;
if (prevProps !== this.props)
{
const { videoTrack, audioTrack } = this.props;
this._setTracks(videoTrack, audioTrack);
this._setTracks(videoTrack, audioTrack);
}
}
_setTracks(videoTrack, audioTrack)