I am displaying a list of entities based on a Flop filter and I am trying to ease-out animate an element, if it is no longer included by the current filter, because for example, the status of the element changed. Now I am encountering the issue, that once the event is triggered that removes an element from the list, that element is placed below the next element, before fading out.
If the list looks like this:
[#1 Element]
[#2 Element]
[#3 Element]
[#4 Element]
And if the #2 element is updated and is no longer included in the filter, the list looks like this while the element is fading out:
[#1 Element]
[#3 Element]
[#2 Element] → fading out
[#4 Element]
I render the list like this in the parent view:
<.live_component
:for={element<- @elements}
module={FooWeb.FooLive.BarItem}
id={"element-#{element.id}"}
element={element}
/>
The live component:
@impl true
def render(assigns) do
~H"""
<article
phx-remove={
JS.hide(transition: {"ease-out duration-1000", "opacity-100", "opacity-0"}, time: 1000)
}
>
BODY
</article>
"""
end
The elements list is assigned on each handle_params and on the handle_info call back that is recieving the updated element messages. Each function assignes a new list of elements. What can I do to prevent the reordering of the elements while the missing one is fading out?






















