return is remote participants is empty array
This commit is contained in:
parent
f735bcf250
commit
f8bd543a43
|
|
@ -72,6 +72,9 @@ export const useSharedState = ({ initialValues = {}, broadcast = true }) => {
|
|||
new Date(p.joined_at) < new Date(localParticipant.joined_at)
|
||||
);
|
||||
|
||||
// avoid sending message if no remote participants are available
|
||||
if (remoteParticipants?.length === 0) return;
|
||||
|
||||
const randomPeer =
|
||||
remoteParticipants[
|
||||
Math.floor(Math.random() * remoteParticipants.length)
|
||||
|
|
|
|||
Loading…
Reference in New Issue