Fix outbound ring cancelation in lobby

This commit is contained in:
Evan Hahn 2021-09-09 16:15:05 -05:00 committed by GitHub
parent cd809a9922
commit 99daad3f3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -382,10 +382,12 @@ export const CallManager: React.FC<PropsType> = props => {
return noop;
}, [shouldRing, playRingtone, stopRingtone]);
const hasActiveCall = Boolean(activeCall);
const isGroupCall = activeCall?.callMode === CallMode.Group;
const mightBeRingingOutgoingGroupCall =
activeCall?.callMode === CallMode.Group &&
activeCall.outgoingRing &&
activeCall.joinState !== GroupCallJoinState.NotJoined;
useEffect(() => {
if (!hasActiveCall || !isGroupCall) {
if (!mightBeRingingOutgoingGroupCall) {
return noop;
}
@ -395,7 +397,7 @@ export const CallManager: React.FC<PropsType> = props => {
return () => {
clearTimeout(timeout);
};
}, [hasActiveCall, setOutgoingRing, isGroupCall]);
}, [mightBeRingingOutgoingGroupCall, setOutgoingRing]);
if (activeCall) {
// `props` should logically have an `activeCall` at this point, but TypeScript can't