In PentoWeb.RatingLive.Index.product_rating/1
function, there is a call to <RatingLive.Show.stars rating={rating} product={@product} />
. Later on, the function is referenced as having the only argument:
with the yet-to- be-built Show.stars/1 component…
what is in line with the defined later function:
defmodule PentoWeb.RatingLive.Show do
use Phoenix.Component
use Phoenix.HTML
attr :rating, :any, required: true
def stars(assigns) do
~H"""
<div>
<%= @rating.stars
|> filled_stars()
|> Enum.concat(unfilled_stars(@rating.stars))
|> Enum.join(" ")
|> raw() %>
</div>
"""
end
...
VS Code even displays a warning about it.
Later, on page 224, the call is correct though:
<Show.stars rating={rating} />
One more point regarding defining an alias for alias PentoWeb.RatingLive.Show
on page 224:
Make sure to alias the module in survey_live.ex like this
PentoWeb.RatingLive.
First, the name of the module is not wrong (survey_live.ex
) and should rather be RatingLive.Index
. In this case, as alias PentoWeb.RatingLive
being already aliased (defined on page 218), the correct module to be aliased would be alias PentoWeb.RatingLive.Show
, and alias PentoWeb.RatingLive
should be removed.