fix(premeeting): call hooks before any conditional block in ConnectionStatus (#11136)

This commit is contained in:
Shahab 2022-03-16 12:29:24 +03:30 committed by GitHub
parent fbe15aaa47
commit 64d32a5005
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -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 (
<div className = { classes.connectionStatus }>
<div