defmodule RemitWeb.DebugLive do
use Phoenix.LiveView
@impl true
def render(assigns) do
~L"""
<%= live_component @socket, ListComponent, %{foo: "bar"} do %>
<p>inner</p>
<% end %>
"""
end
@impl true
def mount(_params, _session, socket) do
{:ok, socket}
end
end
defmodule ListComponent do
use Phoenix.LiveComponent
@impl true
def render(assigns) do
~L"""
<p>outer</p>
<%= @inner_content.(hello: "world") %>
"""
end
@impl true
def mount(socket) do
{:ok, socket}
end
end
I'm assuming here that a map is allowed – but my impression from other code is that it is. Or if it's not, perhaps we could catch that with a better error.
Actual behavior
The combo of an inner content block and map (instead of keyword) assigns causes a cryptic "no function clause matching in Keyword.put/3".
Saw this in an error report by supernintendo in the Slack.
Repro below.
Changing the map to keywords, or skipping the inner content block, makes the error go away.
I suspect this is the offending code: https://github.com/phoenixframework/phoenix_live_view/blob/03b5e697d45f614188aa88094fdc680c6811c997/lib/phoenix_live_view/helpers.ex#L233-L240
Expected behavior
No error. Accepting the map as assigns.
Repro