I just updated to Phoenix LiveView 1.1.0 and suddenly warnings of the form “key $0 will be overridden in map” are starting to creep in during compilation. I managed to break it down to about the following reproduction case that uses the same item for two different arguments to a function component:
defmodule ReproduceWarning do
use Phoenix.LiveView
def render(assigns) do
~H"""
<ul>
<li :for={item <- [%{name: "Primus"}, %{name: "Sekunda"}]}>
<.function_component
file_name={item.name}
animation_names={item}
/>
</li>
</ul>
"""
end
attr :file_name, :string, required: true
attr :animation_names, :map, required: true
def function_component(assigns) do
~H"""
<canvas />
"""
end
end
For me this leads to the following (somewhat misplaced at line 5) compilation warning:
Compiling 1 file (.ex)
warning: key :item will be overridden in map
│
5 │ ~H"""
│ ~~~~~
│
└─ lib/async_dungeon_dive_web/live/session/debug.ex:5
In my actual code the functional component is in a different module, that seemingly does not make a difference though. Passing in a constant for either file_name or animation_names removes the warning.
Am I doing something stupid or is this a bug? From my PoV it should not matter at all that the two arguments to a function call can be calculated with data from the same variable.






















