Programming Phoenix LiveView B2.0: Code comments (pg 244)

To be in sync with the text on page 247:

Now, replace the comment you left in the handle_params/3 function in Pro-
ductLive.Show , with this:

The call to Accounts.get_user_by_session_token/1 should be omitted on page 244:

if connected?(socket) do
  user = Accounts.get_user_by_session_token(user_token)
  # do tracking here!

Also, the implicit refactoring of maybe_track_user/1 on page 247 was a bit distracting at first, though I think it makes sense here to drop the assigns matching and the nil case, as we only have logged in users visiting the product pages.

Hi! Thanks for pointing these out. I’m going to make a few chances to add some clarify and keep things consistent between these two code samples. You’ll find the changes in the next Beta release :slight_smile: