Skip to content

Commit 4e78f53

Browse files
committed
fix: only add field to error function if not already present
1 parent 873d127 commit 4e78f53

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/ash/changeset/changeset.ex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1667,7 +1667,11 @@ defmodule Ash.Changeset do
16671667
Ash.Filter.map(expr, fn
16681668
%Ash.Query.Function.Error{arguments: [module, nested_expr]} = func
16691669
when is_map(nested_expr) and not is_struct(nested_expr) ->
1670-
%{func | arguments: [module, Map.put(nested_expr, :field, field)]}
1670+
if Map.has_key?(nested_expr, :field) || Map.has_key?(nested_expr, :fields) do
1671+
func
1672+
else
1673+
%{func | arguments: [module, Map.put(nested_expr, :field, field)]}
1674+
end
16711675

16721676
other ->
16731677
other

0 commit comments

Comments
 (0)