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