In AshPhoenix.Form.submit, why params option changed to be required?

    if !Keyword.has_key?(opts, :params) do
      IO.warn("""
      The `params` option should be supplied at all times. This will be required in a future major release.
      To silence this warning without providing `params`, you can pass `params: nil`.

      For example:

          def handle_event("submit", %{"form" => params}, socket) do
            case AshPhoenix.Form.submit(socket.assigns.form, params: params) do
              ...
            end
          end
      """)
    end

Why is the params option required now?
I’m just curious about the reason for the decision.

It is due to changes in the way that Phoenix.HTML.Form tracks used fields. On submit, a new parameter is set that shows that all fields have been used, so a validation must occur at the end to “retain” that new field in the case that the form errors and returns {:error, form}

1 Like