From b9c20a3fd46f966558169019a1d9246555758860 Mon Sep 17 00:00:00 2001 From: damencho Date: Fri, 10 Jul 2020 11:50:45 -0500 Subject: [PATCH] fix: Fixes syncing state about lobby in security dialog. --- .../lobby/components/web/LobbySection.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/react/features/lobby/components/web/LobbySection.js b/react/features/lobby/components/web/LobbySection.js index d1d1fe0b9..64a66359e 100644 --- a/react/features/lobby/components/web/LobbySection.js +++ b/react/features/lobby/components/web/LobbySection.js @@ -59,18 +59,19 @@ class LobbySection extends PureComponent { } /** - * Implements {@code PureComponent#componentDidUpdate}. + * Implements React's {@link Component#getDerivedStateFromProps()}. * * @inheritdoc */ - componentDidUpdate(prevProps, prevState) { - if (this.props._lobbyEnabled !== prevProps._lobbyEnabled - && this.state.lobbyEnabled !== prevState.lobbyEnabled) { - // eslint-disable-next-line react/no-did-update-set-state - this.setState({ - lobbyEnabled: this.props._lobbyEnabled - }); + static getDerivedStateFromProps(props: Props, state: Object) { + if (props._lobbyEnabled !== state.lobbyEnabled) { + + return { + lobbyEnabled: props._lobbyEnabled + }; } + + return null; } /**