Just to add one more thing I really disliked like when I used this pattern was that any one-liner error cases (useful for small form that don’t need additional messaging than just the form error) suddenly became three lines, giving them far more visual weight than necessary.
What was:
{:error, changeset} ->
{:noreply, assign(socket, :form, to_form(changeset)}
became:
{:error, changeset} ->
socket
|> assign(:form, to_form(changeset))
|> noreply()
We could make it a one-liner like this:
{:error, changeset} ->
noreply(assign(socket, :form, to_form(changeset)))
which illustrates just how little value is gained here.


















