Programming Phoenix LiveView B4.0: incorrect Presence tracking code (pages 247-250)

Hi @Cellane! Thanks so much for sharing this approach. You are absolutely right that there is a bug in the Presence code in the chapter, as it’s written. The current call to Presence.update actually returns {:error, :nopresence} since we are trying to update data for a pid that is not yet being tracked. You change to only call Presence.track in the track_user/3 function is the way to go. Then, the code to list user presences can be updated accordingly.

You’ll find these changes, and some updated explanations, in either the next Beta release or the one following that.

Thanks again!

1 Like