question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

roster is empty sometimes?

See original GitHub issue

While using useRosterState I see roster is empty sometimes.

const { roster } = useRosterState();
 const attendees = Object.values(roster);

But the attendeeIdToTileId has the right details. const { attendeeIdToTileId } = useRemoteVideoTileState(); I am not able to reproduce when is that happening exactly, but I see it empty sometimes. What could be the reason? Is there a way I can make sure, it is not empty.

Using it like

// userCreatedRoom.jsx not root
<MeetingProvider>
     <div className={classes.root}>
       <UserActivityProvider>
         <MeetingView
           id={id}
         />
       </UserActivityProvider>
     </div>
   </MeetingProvider>

then in MeetingView

export default function MeetingView({
 id,
}) {
 const meetingManager = useMeetingManager();
 const meetingStatus = useMeetingStatus();
 const audioVideo = useAudioVideo();
 const { attendeeIdToTileId } = useRemoteVideoTileState();
 const { roster } = useRosterState();
 const attendees = Object.values(roster);
 console.log('attendees', attendees); // empty array

useEffect(() => {
   join(); // calls meetingManager.join() and start()
   return () => {
     console.log('closing meeting for', id);
     meetingManager.leave();
   };
 }, [id]);

return(
<NiceUI />
);
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
subhendukunducommented, Aug 4, 2021

So you are saying we need to add meetingManager.getAttendee? ATM we arent using this at all. Then meetingManager.getAttendee should be must when you are using useRosterState.

0reactions
devalevenkateshcommented, Oct 5, 2021

Hi @subhendukundu ,

The roster is initialized to {} when the RosterProvider is re-mounted or un-mounted (check here) and hence the state you are seeing is {}.

The library currently does not do any state management to maintain app-refreshes (browser window refreshes). The RosterProvider is dependent on the realtimeSubscribeToAttendeeIdPresence API from Amazon Chime SDK for JavaScript, which we un-subscribe while un-mounting and subscribe while mounting if a valid audioVideo object is present from the meetingSession created in the MeetingManager when you call join and then start on meetingManager from useMeetingManager. So, on browser window refresh, since, no attendee would be present as there is no re-joining taking place in the meetingManager upon browser window refresh, the roster state will be {} as expected.

Now, I am a bit confused on the useRemoteVideoTileState issue. The roster management is audio driven and the RemoteVideoTileProvider which provides the remote video tile state using useRemoteVideoTileState is videoTileDidUpdate and videoTileDidRemoved driven. We do reset the state (check here) when the component un-mounts and hence the map attendeeIdToTileId should be getting cleared as well. I suspect in your case, since the audioVideo object is not valid hence upon window refresh, this RESET never runs and hence the mismatch in state. Can you please add a breakpoint and see if the RESET action is triggered?

I tested this by joining a meeting and leaving the meeting in our react meeting demo and it worked as expected and went through the RESET flow. Unfortunately, as mentioned we do not support browser window refresh and I could not test it as our meeting demo is not setup to handle such use-case.

I tried to check your minimal app but I could not run it due to multiple errors. To debug this further, could you please add an updated README in your minimal app with repro steps? Also, it would be great if you could remove any components that are un-related to this issue to make this a small repro demo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Keeping your Roster empty until game day and filling it in right ...
it's gonna be hilarious when you leaving your roster empty for zero advantage screws you over because your internet goes out and your...
Read more >
Leaving an active roster empty for game week?
Our league voted on allowing empty roster spots 2 years ago but as long as it's not used for collusion. Hard to prove...
Read more >
Notations for Solutions - MathBitsNotebook(A1 - CCSS Math)
Examples of rosters: { } denotes the empty set. The empty set is also denoted with the symbol null , and sometimes referred...
Read more >
ASN article: Double Pivots, Empty Buckets, and the U.S. Roster
Simply put, a double pivot utilizes two holding midfielders, each of whom advance at times while the other holds. The result is usually...
Read more >
What is up with Vendors and shops being empty?
Also, make some work rosters. If you can, keep the shops closer together where there is a lot of traffic. Make sure they...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found