dwyl / phoenix-liveview-counter-tutorial

🤯 beginners tutorial building a real time counter in Phoenix 1.7.7 + LiveView 0.19 ⚡️ Learn the fundamentals from first principals so you can make something amazing! 🚀
https://livecount.fly.dev/
GNU General Public License v2.0
370 stars 36 forks source link

Why `present` increase when refresh the page? #216

Open Frid-Yuandu opened 2 hours ago

Frid-Yuandu commented 2 hours ago

I encounter a problem that the "connected clients" count increase each time I refresh the page. What's the reason of this issue and how could I fix it?

https://github.com/user-attachments/assets/926f29a6-c80c-442a-ba27-0a532c9697d8

nelsonic commented 1 hour ago

@Frid-Yuandu Very interesting. Thanks for reporting this issue. Can you please do us a favour: open a second web browser to the same page and see if the count increase in the second browser. 💭

Frid-Yuandu commented 1 hour ago

Sure, both two clients see the count increase.

https://github.com/user-attachments/assets/e263515c-0a87-4efd-b538-fa7928b2ea69

nelsonic commented 37 minutes ago

Fascinating! Never seen this before. Cannot replicate this on my localhost or on Fly.io: https://livecount.fly.dev 🤷‍♂️ Note: it briefly increments but then resets to 1 (or however many are connected).