steep-balloon-41261
12/19/2022, 4:49 PMacoustic-engineer-41666
12/19/2022, 4:49 PMpolite-kilobyte-67570
12/19/2022, 6:21 PMnarrow-action-3234
12/19/2022, 6:25 PMhistory.push('/') function ⦠my workaround is thinking this is a SPA issue, maybe, is also after this calling window_.location.reload_(); function so I reload the page that Iām redirecting to so I make sure the call connection is closed but also the camera is turning off.acoustic-engineer-41666
12/19/2022, 6:27 PMnarrow-action-3234
12/19/2022, 6:27 PMnarrow-action-3234
12/19/2022, 6:27 PMnarrow-action-3234
12/19/2022, 6:28 PMpolite-kilobyte-67570
12/19/2022, 6:36 PMroom.disconnect()
directly before doing the SPA navigation?narrow-action-3234
12/19/2022, 6:48 PMnarrow-action-3234
12/19/2022, 6:51 PMawait room?.disconnect();
history.push('/');
I disconnected from the call before redirecting but if the user presses the browser back button and as a consequence the component is unmounting Likekit does not detect this and disconnect me from the call and if trying on onmount effect to manually disconnect the user is not working
useEffect(() => {
return () => {
(async () => {
await roomCall?.disconnect();
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);polite-kilobyte-67570
12/19/2022, 7:02 PMuseEffect(() => {
return () => roomCall.disconnect();
});
also, if your roomCall is potentially undefined, are you sure you are actually calling disconnect?
Itās strange that it doesnāt work out of the box for you though. Could you spin up a minimal reproduction repository? that would be helpful in debugging this.narrow-action-3234
12/19/2022, 8:08 PMroomCall being undefined so thatās why is not working ⦠but the interesting part comes if I console.log(roomCall) the values of it comes like this:
useEffect(() => {
return () => {
console.log({roomCall})
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [roomCall]);
Initial render:
{roomCall: undefined}
Second render since is a dependency of `useEffect`:
{roomCall: Room}
On unmount:
{roomCall: undefined}
Not sure why is undefined to be honest on unmount, maybe because Livekit detects that the component unmounts and calls the disconnect function?
But the issue is interesting because even though letās assume LiveKit disconnected me from the call I still can see Iām connected if Iām not manually refreshing the page and if iām going back again in the call and repeat the process w/o refresh the call I can see me multiple times inside the callpolite-kilobyte-67570
12/20/2022, 10:19 AMnarrow-action-3234
12/20/2022, 3:42 PMnarrow-action-3234
12/20/2022, 3:42 PMred-country-59682
12/20/2022, 3:43 PMnarrow-action-3234
12/20/2022, 3:43 PMnarrow-action-3234
12/20/2022, 3:43 PMnarrow-action-3234
12/20/2022, 3:43 PMnarrow-action-3234
12/20/2022, 3:43 PMred-country-59682
12/20/2022, 3:44 PMnarrow-action-3234
12/20/2022, 3:46 PM<https://example.livekit.io/#/>narrow-action-3234
12/20/2022, 3:47 PMnarrow-action-3234
12/20/2022, 3:50 PMpolite-kilobyte-67570
12/20/2022, 4:10 PMnarrow-action-3234
12/20/2022, 4:17 PMnarrow-action-3234
12/20/2022, 4:18 PMpolite-kilobyte-67570
12/22/2022, 4:08 PMnarrow-action-3234
12/22/2022, 4:16 PMnarrow-action-3234
12/22/2022, 4:17 PM