Cannot use slot and more than one attr with LiveView 0.18.3, throws compilation error

Hi!

After upgrading from LiveView 0.17.5 to 0.18.3, when I try to use more than one attr I’m getting the following error:

== Compilation error in file [...] ==
** (KeyError) key :name not found in: {:doc, nil}. If you are using the dot syntax, such as map.field, make sure the left-hand side of the dot is a map
    (phoenix_live_view 0.18.3) lib/phoenix_component/declarative.ex:377: anonymous fn/2 in Phoenix.Component.Declarative.validate_attr_type!/7
    (elixir 1.14.2) lib/enum.ex:1151: anonymous fn/3 in Enum.find/3
    (elixir 1.14.2) lib/enum.ex:4751: Enumerable.List.reduce/3
    (elixir 1.14.2) lib/enum.ex:1150: Enum.find/3
    (phoenix_live_view 0.18.3) lib/phoenix_component/declarative.ex:377: Phoenix.Component.Declarative.validate_attr_type!/7
    (phoenix_live_view 0.18.3) lib/phoenix_component/declarative.ex:337: Phoenix.Component.Declarative.__attr__!/6

eg. this compiles:

  # attr :active, :atom, required: true, values: [:tasks, :chart, :delivery]
  attr :project_id, :integer

  def task_tabs(assigns) do

But if I uncomment the first line, it fails compiling.

For slot, even for a simple definition like

slot :title

def card(assigns) do
    ~H"""
    <div class="card m-3" style="width: 18rem;">
      <div class="card-body d-flex flex-column">
        <%= render_slot(@title) %>
        <%= render_slot(@body) %>
      </div>
    </div>
    """
end

I’m getting

== Compilation error in file [...] ==
** (Protocol.UndefinedError) protocol Enumerable not implemented for nil of type Atom
    (elixir 1.14.2) lib/enum.ex:1: Enumerable.impl_for!/1
    (elixir 1.14.2) lib/enum.ex:166: Enumerable.reduce/3
    (elixir 1.14.2) lib/enum.ex:4307: Enum.reverse/1
    (phoenix_live_view 0.18.3) lib/phoenix_component/declarative.ex:252: Phoenix.Component.Declarative.__slot__!/6

My deps:

      {:bcrypt_elixir, "~> 3.0"},
      {:phoenix, "~> 1.6.15"},
      {:phoenix_ecto, "~> 4.4"},
      {:ecto_sql, "~> 3.6"},
      {:postgrex, ">= 0.0.0"},
      {:csv, "~> 3.0"},
      {:phoenix_html, "~> 3.0"},
      {:phoenix_live_reload, "~> 1.2", only: :dev},
      {:phoenix_live_view, "~> 0.18.3"},
      {:floki, ">= 0.30.0", only: :test},
      {:phoenix_live_dashboard, "~> 0.7.2"},
      {:swoosh, "~> 1.3"},
      {:gen_smtp, "~> 1.2"},
      {:hackney, "~> 1.18"},
      {:telemetry_metrics, "~> 0.6"},
      {:telemetry_poller, "~> 1.0"},
      {:gettext, "~> 0.18"},
      {:jason, "~> 1.2"},
      {:plug_cowboy, "~> 2.5"},
      {:libgraph, "~> 0.16.0"}

What am I doing wrong?

Thanks!

Have you got use Phoenix.Component at the top of the file?

That was the problem, thanks a lot!

The changelog led me astray a bit with

You must import Phoenix.Component where you previously imported Phoenix.LiveView.Helpers when upgrading.

But now I see it on the top of the docs page, too, that it should be use-d not just import-ed.