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

Calling track fires both the join and leave events #1167

Open
netgfx opened this issue Oct 17, 2024 · 0 comments
Open

Calling track fires both the join and leave events #1167

netgfx opened this issue Oct 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@netgfx
Copy link

netgfx commented Oct 17, 2024

Bug report

  • [x ] I confirm this is a bug with Supabase, not with my own application.
  • [x ] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

When calling presence.track() the join and leave events are firing as well

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. setup listeners:
const presence = presenceChannel
           .on('presence', { event: 'sync' }, () => {
              const state = presenceChannel.presenceState<PresencePlayer>()
          })
          .on(
           'presence',
           { event: 'join' },
           ({ key, newPresences }) => {
                console.log('Player joined:', key, newPresences)
            })
          .on(
         'presence',
         { event: 'leave' },
          ({ key, leftPresences }) => {
                console.log('Player left:', key, leftPresences)
           } )
    }
     ```
   2. call track `presence.track(updatedPlayer)`
   3. The join and leave events fire

## Expected behavior

The join and leave events don't fire if there is no new user joining or leaving

## Screenshots

![image](https://github.com/user-attachments/assets/578a4243-8f61-4cde-89a8-ab5ce7f31b66)

## System information

- OS: Windows
- Browser: chrome
- Version of supabase-js: 2.45.4
- Version of Node.js: 20.17.0

## Additional context
@netgfx netgfx added the bug Something isn't working label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant