Seems to avoid almost all invalid states (hang up while viewing another lobby and hitting join seems to black screen, sets the active call as the previous active room id, but does join the viewed room correctly)
This commit is contained in:
1 parent
22903c9340
commit
108eb60b4a
1 file changed
+6
-5
@@ -207,15 +207,14 @@ export function CallProvider({ children }: CallProviderProps) {
|
||||
(nextRoom: string) => {
|
||||
setIsCallActive(false);
|
||||
if (typeof nextRoom !== 'string') {
|
||||
if (viewedCallRoomId === activeCallRoomId) {
|
||||
if (activeCallRoomId && viewedCallRoomId === activeCallRoomId) {
|
||||
setIsPrimaryIframe(!isPrimaryIframe);
|
||||
} else {
|
||||
setViewedCallRoomId(activeCallRoomId);
|
||||
}
|
||||
logger.error(`${activeCallRoomId} ${viewedCallRoomId}`);
|
||||
setViewedCallRoomId(activeCallRoomId);
|
||||
} else if (viewedCallRoomId !== null) {
|
||||
setIsPrimaryIframe(!isPrimaryIframe);
|
||||
setViewedCallRoomId(null);
|
||||
}
|
||||
} else if (activeCallRoomId) setViewedCallRoomId(nextRoom);
|
||||
setActiveClientWidgetApi(null, null, null);
|
||||
setActiveCallRoomId(null);
|
||||
|
||||
@@ -323,6 +322,8 @@ export function CallProvider({ children }: CallProviderProps) {
|
||||
activeClientWidgetApi?.removeAllListeners();
|
||||
activeClientWidgetApi?.transport.send(WIDGET_HANGUP_ACTION, {}).then(() => {
|
||||
setViewedAsActive();
|
||||
setViewedCallRoomIdState(null);
|
||||
setViewedClientWidgetApi(null, null, null);
|
||||
});
|
||||
} else {
|
||||
setIsCallActive(true);
|
||||
|
||||
Reference in new issue
Block a user