trisolaran

trisolaran

Update of LiveComponent fails with error "component ABC with ID XYZ does not exist or it has been removed"

Hi,

I’m rendering a live component in a for loop:

 <%= for mapping_form <- inputs_for(f, :mapping)  do %>
    ...
                <.live_select
                  form={mapping_form}
                  field={:source_field}
                  phx-target={@myself}
                  options={source_field_option_list(@changeset)}
                  update_min_len={0}
                />
<% end %>

“live_select” renders a live component. What I want to do is to update the component dynamically using send_update:

send_update(LiveSelect, id: id, options: options)

This fails with the error:

send_update failed because component LiveSelect with ID "custom_mapping[mapping][0]_source_field_live_select_component" does not exist or it has been removed

However, when I inspect the DOM, I see the live compnent is there and has the expected id custom_mapping[mapping][0]_source_field_live_select_component

I’m kind of puzzled by this issue, as far as I know sending updates to LiveComponents should work even if they’re rendered in a loop.

Wondering if anyone can give me a hint or can think of any reason that would cause the LiveComponent not to be found by LiveView.

Thanks!

P.S: using the new <.inputs_for> component instead of the loop didn’t change anything

Marked As Solved

trisolaran

trisolaran

hahah absolute brain fart :laughing:

I was using the wrong module name: it should be LiveSelect.Component not LiveSelect.

And I wrote the damn library!! I should go back and read my own docs :man_facepalming:

In my defence: It’s been a really hard week for me. I will close this topic and sorry.

Where Next?

Popular in Questions Top

openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
dokuzbir
Hello, I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these buyer = %{ id: ...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
sabri
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size? Thanks
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
William
I would like to know that is there any online source for learning Phoenix Framework for building E-Commerce Store? Any advantage on build...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

We're in Beta

About us Mission Statement