Programming Phoenix LiveView B8: Confusing unused parameters (p. 57)

In the code sample for auth /pento/lib/pento_web/live/user_auth_live.ex the on_mount function is defined as:

on_mount(_, params, %{"user_token" => user_token} = _session, socket)

It seems the the params argument is never used so could be replaced with _params while the assignment to _session seems unnecessary so we end up with:

on_mount(_, _params, %{"user_token" => user_token}, socket)

Thanks for your feedback! We are hard at work on a major revision right now and will release the new version of the book before the end of February with this addressed.

1 Like

Hello @SophieDeBenedetto, thank you for this good news!

I have a question please, will this new version of the book include Phoenix 1.7?
Either way, it’s a great book!

Indeed it will!

3 Likes

This is fantastic, I can’t wait to get it! ^^