Event handlers like user-added apparently execute callback upon creation regardless of event

Description
When I create event handlers for user add, remove, update, it appears the callback function executes immediately upon the handler being created.

Browser Console Error
The callback function gets called when zoomClient.on(‘user-added’, callback) (and any other handler related to users) is created, even if a user was not added.

Which Web Video SDK version?
1.1.5

Video SDK Code Snippets
useEffect(() => { console.log(':: useParticipantsChange: useEffect'); zoomClient.on('user-added', () => callback('joined')); zoomClient.on('user-removed', () => callback('left')); zoomClient.on('user-updated', () => callback('updated')); return () => { zoomClient.off('user-added', callback); zoomClient.off('user-removed', callback); zoomClient.off('user-updated', callback); }; }, [zoomClient, callback]);

To Reproduce(If applicable)
Steps to reproduce the behavior:

  1. Reload page
  2. ALL of the event handlers get triggered immediately, but then also execute as expected on subsequent, real events.

Screenshots
Apparently I can’t embed?

Device (please complete the following information):

  • Device: MacBook Pro
  • OS: MacOS
  • Browser: Chrome
  • Browser Version: Latest

Additional context
As you can see, I want to update a status message only when a user joins, leaves or is updated. The screenshot shows when I first initiate the session – all three get triggered. If someone joins later, I get the proper “joined” message.

Hey @StackRef , thanks for posting and using the Video SDK! :slight_smile:

Upon reload this is expected as a reload emulates a disconnection, and then reconnection. Although, it does not sound right that user-updated would also trigger.

Thanks,
Tommy

I believe user-updated might trigger because it considers updating the user device information and hosting status as an update. Just a guess.

By “reload” do you mean the DOM is regenerated (using React), or a full page reload?

Hey @StackRef ,

That sound correct.

A full page reload like you mentioned:

Thanks,
Tommy

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.