Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #7: Add idType param to useParticipantIds #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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