fix: don't run any before_action hooks if changeset is invalidated in prior hook

This commit is contained in:
Zach Daniel 2024-06-21 11:04:26 -04:00
parent cb29738927
commit 2bdc6efde3

View file

@ -3271,6 +3271,7 @@ defmodule Ash.Changeset do
@doc false
def run_before_actions(%{before_action: []} = changeset), do: {changeset, %{notifications: []}}
def run_before_actions(%{valid?: false} = changeset), do: changeset
def run_before_actions(changeset) do
can_do_atomic? = data_layer_can_do_atomic_for_changest?(changeset)