From 64d32a5005dcd290e891fbcd7f8abfc08339fc8d Mon Sep 17 00:00:00 2001 From: Shahab <45701680+c0m1t@users.noreply.github.com> Date: Wed, 16 Mar 2022 12:29:24 +0330 Subject: [PATCH] fix(premeeting): call hooks before any conditional block in ConnectionStatus (#11136) --- .../premeeting/components/web/ConnectionStatus.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/react/features/base/premeeting/components/web/ConnectionStatus.js b/react/features/base/premeeting/components/web/ConnectionStatus.js index a387229a7..0383832ef 100644 --- a/react/features/base/premeeting/components/web/ConnectionStatus.js +++ b/react/features/base/premeeting/components/web/ConnectionStatus.js @@ -148,11 +148,6 @@ const CONNECTION_TYPE_MAP = { function ConnectionStatus({ connectionDetails, t, connectionType }: Props) { const classes = useStyles(); - if (connectionType === CONNECTION_TYPE.NONE) { - return null; - } - - const { connectionClass, icon, connectionText } = CONNECTION_TYPE_MAP[connectionType]; const [ showDetails, toggleDetails ] = useState(false); const arrowClassName = showDetails ? 'con-status-arrow con-status-arrow--up' @@ -174,6 +169,12 @@ function ConnectionStatus({ connectionDetails, t, connectionType }: Props) { } }, [ showDetails, toggleDetails ]); + if (connectionType === CONNECTION_TYPE.NONE) { + return null; + } + + const { connectionClass, icon, connectionText } = CONNECTION_TYPE_MAP[connectionType]; + return (