Skip to content

Commit

Permalink
fix: reselect required attributes unless reuse_values? is true
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Sep 24, 2024
1 parent 873626b commit 3567f96
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/ash/actions/read/read.ex
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,14 @@ defmodule Ash.Actions.Read do
query.select
|> List.wrap()
|> Kernel.--(Ash.Resource.Info.primary_key(query.resource))
|> Enum.reject(&Ash.Resource.selected?(first, &1))

must_be_reselected =
if opts[:reuse_values?] do
must_be_reselected
|> Enum.reject(&Ash.Resource.selected?(first, &1))
else
must_be_reselected
end

{query, calculations_at_runtime, calculations_in_query} =
Ash.Actions.Read.Calculations.deselect_known_forbidden_fields(
Expand Down

0 comments on commit 3567f96

Please sign in to comment.