fly-apps / live_beats

MIT License
1.26k stars 159 forks source link

Users - Active or not? #42

Open davidtew opened 2 years ago

davidtew commented 2 years ago

Sat 12th Feb 2022 I logged in. I managed to get to the URL https://livebeats.fly.dev/anujmiddha although I can't remember how I got there, since there were no ACTIVE USERS listed for me to click on (see screen shot below). I could hear the music intermittently ie on for a while, stopped for a bit, as if user anujmiddha was actually active (and listening, but switching between play & pause). Furthermore, I noticed upon inspecting the screen shot that the ping ms is not visible on my avatar nor the other users.
(all tests on Mac 11.5.2 Firefox V96.0.3) image

joshchernoff commented 2 years ago

Clicking on any navigation seems to trigger what ever remount or what ever that updates the nav with active users. My assumption is that its not getting what ever message it needs upon the player starting/stopping.

Edit; After looking into this you will notice that sidebar_active_users is just a function component https://github.com/fly-apps/live_beats/blob/819d5ecc9850ff8f49013f3151213a4419ab44a2/lib/live_beats_web/templates/layout/live.html.heex#L36-L41 is not a part of a stateful component nor a live view itself. In short the only way for it to update is via a some event like live_redirect. Thus the state of this view won't update on its own without remounting. This is also why when using the nav which causes a remount to happen updates the view.