Reply-Function for LiveViews

I love chaining pipeline myself; however, I try to limit the chaining to functions that return a value in the same shape. socket and {:noreply, socket} are not the same shape. My idiom for handle_event is:

def handle_event("something", _, %Socket{assigns: %{...}} = socket) do
  {:noreply, do_something(socket, ...)}
end

defp do_something(socket, ...) do
    socket
    |> assign(...)
    |> push_event(...)
end

I only use the handle_event to destructure the socket, and all operations on socket is done in do_something call, which ofen contains long chain of piping function calls.

Disclaimer: I don’t think my idiom is the one true idiom that everyone else should follow.