How do I reset form input on submit?

My form:

 def mount(socket) do
    {:ok,
     socket
     |> assign(:form, to_form(%{"input_msg" => ""}))}
  end

 <.form for={@form} phx-target={@myself} phx-submit="save" class="w-full flex gap-2">
        <.input
          field={@form[:input_msg]}
          autocomplete="off"
          name="message"
          type="text"
        />
....

And the submit function ends like this:
{:noreply, socket |> assign(:form, to_form(%{"input_msg" => ""}))}

render/1 is not called after this, even though socket should be changed.
What am I doing wrong?

Thanks.

You aren’t changing the value of the assign, so from the framework’s point of view nothing has changed so there is no need to re-render. Add a phx-change="change" on the form and update the form assign.

Any particular reason you are giving the input name="message"?

You can probably just pass an empty map to to_form to clear the value.

Thanks @cmo adding phx-change fixed it.