lustre-labs / lustre

A Gleam web framework for building HTML templates, single page applications, and real-time server components.
https://hexdocs.pm/lustre
MIT License
1.16k stars 75 forks source link

lustre/element fragment doesn't update child elements properly #160

Closed yoonthegoon closed 1 month ago

yoonthegoon commented 3 months ago

Problem

When a fragment has child elements that are removed (like from a model being updated), those elements are not totally removed.

This is different from the behavior of a div.

Visual

Below is my initial state.

image

Containing everything will either be a div or fragment. In both scenarios, I remove the top transaction form.

div

image

fragment

image

As you can see, removing the top transaction form in a fragment leaves the total count of forms the same, simply duplicating the last form and associating those forms with the same transaction in my model.

hayleigh-dot-dev commented 3 months ago

Thank you, I'll take a look at this.

JScearcy commented 2 months ago

I was able to reproduce, working on a fix now!

hayleigh-dot-dev commented 1 month ago

I believe this is fixed now, please re-open if you run into anything again!