We are currently experiencing an issue with a form we recently created that has several nested LiveView fields. Our form is currently defined as such:
<%= f = form_for @changeset, "#", [class: "liveview-container", phx_change: :validate, phx_submit: :save] %>
The primary issue we are experiencing is our nested LiveView fields are remounted on the parent’s state change; it does not matter what changed on the socket’s assigns, it will cause a full re-render of the form.
This is particularly problematic for our nested LiveView fields because we load data on mount, which the form’s
on change exacerbates. In addition to this, we are also seeing all of the static and dynamic bits being sent on every change. I assume this might be an issue with how diffs are handled with something like the changeset?
A link to the parent template (ignore
.eex extension, had to use it instead of
.leex for GitHub to highlight): https://gist.github.com/barkerja/4db76c5bbc73dc503b5d5aa089ced076