Ash FrameworkAF
Ash Framework3y ago
15 replies
michaelst

warning: Changeset has already been validated for action :create.

I am getting this warning when trying to set an attribute before submitting a form, since this isn't user provided and I don't want to make the http call if this isn't going to be submitted, is there maybe another way to accomplish this as the warning says this will be an error in the future.
 case AshPhoenix.Form.submit(socket.assigns.form,
        params: params,
        before_submit: fn changeset ->
          {:ok, %{body: %{"id" => stripe_customer_id}}} = QueryDesk.Stripe.create_customer()

          changeset
          |> Ash.Changeset.change_attribute(:stripe_customer_id, stripe_customer_id)
          |> Ash.Changeset.manage_relationship(
            :users,
            [socket.assigns.current_user],
            type: :append_and_remove
          )
        end
      ) do
Was this page helpful?