joepstender

joepstender

Programming Phoenix LiveView: errata and remarks Version B2.0

The generated iex result below should list products instead of product for the metadata. (page 67)

iex> product = %Product{}
 %Pento.Catalog.Product{
 __meta__: #Ecto.Schema.Metadata<:built, "product">,
 …
}

The mount/3 function that is generated is different from the one used in the example, this might be confusing if you are familiar with the way pipes are used in Elixir. (Page 87)

def mount(_params, _session, socket) do
 {:ok,
 socket
 |> assign(:greeting, "Welcome to Pento!") # add this line
 |> assign(:products, list_products())}
end

Instead of

{:ok, assign(socket, :products, list_products())}

These few lines of code are a bit different from what we’ve seen before,… (Page 98)

Actually we have already seen this exact code 2 pages earlier, starting on page 96.
Suggestion: introduce the repeated code with: “Here’s the line of code that calls the modal component from the index template again:”

That means the component must implement a handle_event/3 function for the “close” event, which is does here: (Page 103)

Should be “… which it does here:”

Notice there’s an :id key, as well as a :component key that specifies the FormComponent (Page 106)

It is unclear what the :component_key is.

Marked As Solved

SophieDeBenedetto

SophieDeBenedetto

Author of Programming Phoenix LiveView

Hello! Thank you so much for your feedback, we really appreciate it :slight_smile:

Let’s go through it one thing as a time:

The generated iex result below should list products instead of product for the metadata. (page 67)

You are totally right! You’ll find this fixed in the next Beta release. Thanks for pointing it out :slight_smile:

The mount/3 function that is generated is different from the one used in the example, this might be confusing if you are familiar with the way pipes are used in Elixir. (Page 87)

Good catch! In fact this code snippet does change the way the generated mount/3 function calls assign in order to add the products to the socket. You’ll find this updated for clarity in the next Beta release.

Actually we have already seen this exact code 2 pages earlier, starting on page 96.
Suggestion: introduce the repeated code with: “Here’s the line of code that calls the modal component from the index template again :”

Yep you are right that we’ve shown you this code snippet already. I’ll add some language to clarify that in the next release.

Should be “… which it does here:”

Nice catch! Will fix in the next release.

It is unclear what the :component_key is.

The :component key points to a value of the component that will be rendered in the modal–FormComponent. I’ll add some language to clarify this but we also go into greater detail just a bit further on in the chapter.

Thanks again!

Popular Prag Prog topics Top

jimschubert
In Chapter 3, the source for index introduces Config on page 31, followed by more code including tests; Config isn’t introduced until pag...
New
johnp
Running the examples in chapter 5 c under pytest 5.4.1 causes an AttributeError: ‘module’ object has no attribute ‘config’. In particula...
New
jeffmcompsci
Title: Design and Build Great Web APIs - typo “https://company-atk.herokuapp.com/2258ie4t68jv” (page 19, third bullet in URL list) Typo:...
New
herminiotorres
Hi @Margaret , On page VII the book tells us the example and snippets will be all using Elixir version 1.11 But on page 3 almost the en...
New
JohnS
I can’t setup the Rails source code. This happens in a working directory containing multiple (postgres) Rails apps. With: ruby-3.0.0 s...
New
fynn
This is as much a suggestion as a question, as a note for others. Locally the SGP30 wasn’t available, so I ordered a SGP40. On page 53, ...
New
brunogirin
When running tox for the first time, I got the following error: ERROR: InterpreterNotFound: python3.10 I realised that I was running ...
New
ggerico
I got this error when executing the plot files on macOS Ventura 13.0.1 with Python 3.10.8 and matplotlib 3.6.1: programming_ML/code/03_...
New
mcpierce
@mfazio23 I’ve applied the changes from Chapter 5 of the book and everything builds correctly and runs. But, when I try to start a game,...
New
SlowburnAZ
Getting an error when installing the dependencies at the start of this chapter: could not compile dependency :exla, "mix compile" failed...
New

Other popular topics Top

New
AstonJ
I’ve been hearing quite a lot of comments relating to the sound of a keyboard, with one of the most desirable of these called ‘thock’, he...
New
Margaret
Hello content creators! Happy new year. What tech topics do you think will be the focus of 2021? My vote for one topic is ethics in tech...
New
Rainer
Not sure if following fits exactly this thread, or if we should have a hobby thread… For many years I’m designing and building model air...
New
AstonJ
If you are experiencing Rails console using 100% CPU on your dev machine, then updating your development and test gems might fix the issu...
New
OvermindDL1
Woooooooo! This is such a huge release for it, and 2 years incoming! In short, the library is now using an updated hyper backend (not j...
New
AstonJ
Biggest jackpot ever apparently! :upside_down_face: I don’t (usually) gamble/play the lottery, but working on a program to predict the...
New
PragmaticBookshelf
Author Spotlight: VM Brasseur @vmbrasseur We have a treat for you today! We turn the spotlight onto Open Source as we sit down with V...
New
PragmaticBookshelf
Author Spotlight: Peter Ullrich @PJUllrich Data is at the core of every business, but it is useless if nobody can access and analyze ...
New
AstonJ
This is a very quick guide, you just need to: Download LM Studio: https://lmstudio.ai/ Click on search Type DeepSeek, then select the o...
New

Latest in PragProg

View all threads ❯