Skip to content

Update to LiveView 1.1.0: warning: key :xyz will be overridden in map #3912

@Cervajz

Description

@Cervajz

Environment

  • Elixir version (elixir -v): 1.19.0-rc.0 (2a9a4f2) (compiled with Erlang/OTP 28)
  • Phoenix version (mix deps): 1.7.21
  • Phoenix LiveView version (mix deps): 1.1.0
  • Operating system: macOS
  • Browsers you attempted to reproduce this bug on (the more the merrier): n/a
  • Does the problem persist after removing "assets/node_modules" and trying again? Yes/no: n/a

Actual behavior

After updating the application to LiveView 1.1.0 I am getting a lot of warnings from HEEX templates anywhere <%= for xyz <- @collection do %> is used.

I tried to convert it to the new format, adding the :key (as per CHANGELOG.md) but the warning is still there for the same piece of code. Fox example:

<.link
  :for={segment <- @user_segments}
  :key={segment.id}
  navigate={~p"/contacts/users/segments/#{segment.id}"}
  class="group w-full flex items-center pl-16 pr-2 py-2 text-sm font-medium rounded-md">
  {segment.name}
</.link>
warning: key :segment will be overridden in map
    │
  1 │ <div>~~~~~
    │
    └─ lib/dashboard_web/live/shared_components/navigation/sidebar_component.html.heex:1

Expected behavior

There were no warning of such nature before the update.

Is there anything I missed or misunderstood? Thank you.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions