Skip to content

Comments

Fix #7: Add idType param to useParticipantIds#8

Open
rileyjshaw wants to merge 1 commit intodaily-co:mainfrom
rileyjshaw:patch-1
Open

Fix #7: Add idType param to useParticipantIds#8
rileyjshaw wants to merge 1 commit intodaily-co:mainfrom
rileyjshaw:patch-1

Conversation

@rileyjshaw
Copy link
Contributor

See #7 for discussion.

@troutowicz
Copy link

troutowicz commented Oct 8, 2024

Would love to see this merged. What we have now works, but adds work.

function useParticipantUserIds({filter}) {
  const daily = useDaily()
  const localSessionId = useLocalSessionId()
  const participantIds = useParticipantIds({filter})

  const userIds = useMemo(() => {
    const userIds = []
    const participants = daily.participants()
    for (let i = 0; i < participantIds.length; i++) {
      const id =
        participantIds[i] === localSessionId ? 'local' : participantIds[i]
      if (participants[id]?.user_id) {
        userIds.push(participants[id].user_id)
      }
    }
    return [...new Set(userIds)]
  }, [daily, localSessionId, participantIds])

  return userIds
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants