Programming Phoenix LiveView B8: entire Ch4 modal component section needs correcting Page 101-114

Title: Programming Phoenix LiveView B8 - entire Ch4 modal component section needs correcting (Page 101-114)
Example: Programming Flutter - ‘pub get’ command not working (page 15)

The entire treatment on the modal components in Chapter 4 is outdated and incorrect. It was like this the last time I tried to go trough the book in a previous beta, months ago, and had hoped that such glaring errors would have been fixed in Beta 8. Unfortunately, that’s not the case. I’m not going to point out every error, because there are dozens and they are incredibly glaring, but I will point out where it all starts.

Page 101 begins with the incorrect code snippet:

<%= if @live_action in [:new, :edit] do %>
  <%= live_modal PentoWeb.ProductLive.FormComponent,
    id: @product.id || :new,
    title: @page_title,
    action: @live_action,
    product: @product,
    return_to: Routes.product_index_path(@socket, :index) %>
<% end %>

The correct code, as generated by the mix phx.gen.live generator is as follows:

<%= if @live_action in [:new, :edit] do %>
  <.modal return_to={Routes.product_index_path(@socket, :index)}>
    <.live_component
      module={PentoWeb.ProductLive.FormComponent}
      id={@product.id || :new}
      title={@page_title}
      action={@live_action}
      product={@product}
      return_to={Routes.product_index_path(@socket, :index)}
    />
  </.modal>
<% end %>

These differences have widespread ramifications throughout the text and across multiple files in the project.

Additionally, there is more than once instance of outdated template extensions being referenced in this section.

For example: index.html.leex should be index.html.heex.

Please please please prioritize preventing Chapter 4, as currently written, from making it into the next release.

4 Likes

Hi there, we are hard at work on a major revision right now and plan to release a new version of the book before the end of February :slight_smile:

1 Like

2 posts were split to a new topic: Programming Phoenix LiveView: will there be an update soon?