fix:fix the issue of asynchronous exit room status in the receiver

This commit is contained in:
david_bai
2025-08-14 23:13:09 +08:00
parent 307232bd15
commit f98e836e71
+4
View File
@@ -228,6 +228,10 @@ export function useWebRTCConnection({
console.log(`Receiver peer ${peerId} disconnected.`);
// On the receiver side, any peer is a sender.
setSenderDisconnected(true);
// Set peer count to 0 since the peer has disconnected
// Note: receiver.peerConnections.size might still be > 0 at this point
// because cleanupExistingConnection hasn't been called yet
setRetrievePeerCount(0);
};
receiver.onConnectionEstablished = (peerId) => {