Heex warning: key :id will be overridden in map

Hi, I have these warnings in my heex file, so I do not know when this problem created, but I know it was after updating phoenix LiveView.

warning: key :id will be overridden in map
  lib/mishka_html_web/templates/client_blog/blog_post_live.html.heex:1

warning: key :id will be overridden in map
  lib/mishka_html_web/templates/client_blog/blog_post_live.html.heex:1

The heex file:

I am using :phoenix_live_view, "~> 0.17.7" and elixir Elixir 1.13.2

Here:

  <span class="badge bg-secondary">ارسال شده:
               <.live_component module={MishkaHtmlWeb.Public.TimeConverterComponent}
                        id={"inserted-#{@post.id}-component"}
                        span_id={"inserted-#{@post.id}-component"}
                        id={"inserted-#{@post.id}-component"}
                        time={@post.inserted_at}
                />
               </span>

and here:

   <span class="badge bg-info"><%= MishkaTranslator.Gettext.dgettext("html_live_templates", "به روز شده:") %>
               <.live_component module={MishkaHtmlWeb.Public.TimeConverterComponent}
                        id={"updated-#{@post.id}-component"}
                        span_id={"updated-#{@post.id}-component"}
                        id={"updated-#{@post.id}-component"}
                        time={@post.updated_at}
                />
               </span>

You have id twice in the same live_component. So the second will override the first

1 Like

Thank you, the warning is not clear in addressing

1 Like