Elixir_begginer
Nested Liveview: duplicate id error
Hello,
can anyone help me out with a problem I’m unable to solve by googling and searching through the forum.
I’m using a nested liveview for my navbar and sidebar so the layout html, which is the entrance point of the nested view, looks like this:
<%= live_render(@socket, HelloWeb.DashboardLive,
id: "dashboard_shell",
sticky: true
) %>
<main class="mx-auto max-h-screen overflow-auto px-2 pt-11 pb-16 lg:px-6 2xl:ml-56">
<%= @inner_content %>
<.flash_group flash={@flash} />
</main>
With the mount function in the dashboard_live.ex looking like this:
def mount(_params, _session, socket) do
{:ok, socket, layout: false}
end
This creates two liveviews, which I want, however, when loading the page on the client side, I get this console error:
Multiple IDs detected: client-error. Ensure unique element ids.
Upon searching for the multiple ids, it looks like that both liveviews create a div with id="client-error" and a div with id="server-error", so I have this duplicate divs in both views with the same id.
Does anyone know how I can fix this?
EDIT: Maybe I should ignore this error?
Thank you
Marked As Solved
codeanpeace
Hmm, those two ids are used in the <.flash_group .../> component from the default core_components.ex. Have you added that component anywhere else – maybe in DashboardLive?
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









