fix: Fixes syncing state about lobby in security dialog.
This commit is contained in:
parent
23507da59a
commit
b9c20a3fd4
|
@ -59,18 +59,19 @@ class LobbySection extends PureComponent<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements {@code PureComponent#componentDidUpdate}.
|
* Implements React's {@link Component#getDerivedStateFromProps()}.
|
||||||
*
|
*
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
componentDidUpdate(prevProps, prevState) {
|
static getDerivedStateFromProps(props: Props, state: Object) {
|
||||||
if (this.props._lobbyEnabled !== prevProps._lobbyEnabled
|
if (props._lobbyEnabled !== state.lobbyEnabled) {
|
||||||
&& this.state.lobbyEnabled !== prevState.lobbyEnabled) {
|
|
||||||
// eslint-disable-next-line react/no-did-update-set-state
|
return {
|
||||||
this.setState({
|
lobbyEnabled: props._lobbyEnabled
|
||||||
lobbyEnabled: this.props._lobbyEnabled
|
};
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue