The useParticipantIds() hook gets called constantly in the Call.js component

Options

Hi,

why is this hook called every second in the Call.js component?

const remoteParticipantIds = useParticipantIds({ filter: 'remote' });
useEffect(() => { console.log({remoteParticipantIds}) }, [remoteParticipantIds])

Latest react repository:

"@daily-co/daily-js": "^0.47.0",

"@daily-co/daily-react": "^0.10.0"

Thank you

Tagged:

Comments

  • christian
    christian Dailynista
    Options

    Hey @Daniel808,

    just so we can follow up: are you referring to the demo at https://github.com/daily-demos/custom-video-daily-react-hooks? Or is it another repository?

    Thanks in advance!

    Christian

  • Daniel808
    Options

    Yes, it`s that repository.

  • christian
    christian Dailynista
    Options

    I checked out the repository locally and updated to the same versions as you provided.

    Adding the same useEffect with the console.log, doesn't seem to lead to the same effect you're seeing. At least I am not seeing the ids being logged every second.

    It's important to know though, that useParticipantIds is based on all participant's states. There is likely some room for improvements to avoid useParticipantIds return the same set of ids multiple times.

    In its current form useParticipantIds re-renders when a participant's state changes.

    I'll create a ticket for further investigation.

  • Daniel808
    Options

    "In its current form useParticipantIds re-renders when a participant's state changes."

    Exactly. If I mute a participant for example, it re-renders. Would be great if that can get fixed.

  • christian
    christian Dailynista
    Options

    @Daniel808 have you checked out the most recent version of Daily React?

    We've put a bunch of effort into improving the render performance of useParticipantIds and useParticipantProperty. I'd suggest checking out the 0.11.5 release!