Skip to content

Commit

Permalink
fix: set right defaults for action_select (#1476)
Browse files Browse the repository at this point in the history
  • Loading branch information
vonagam authored Sep 25, 2024
1 parent e25f9c6 commit f95921f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/ash/resource/actions/create.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defmodule Ash.Resource.Actions.Create do
manual: nil,
notifiers: [],
touches_resources: [],
action_select: [],
action_select: nil,
delay_global_validations?: false,
skip_global_validations?: false,
skip_unknown_inputs: [],
Expand All @@ -33,7 +33,7 @@ defmodule Ash.Resource.Actions.Create do
accept: nil | list(atom),
require_attributes: list(atom),
allow_nil_input: list(atom),
action_select: list(atom),
action_select: list(atom) | nil,
manual: module | nil,
upsert?: boolean,
skip_unknown_inputs: list(atom | String.t()),
Expand Down
6 changes: 3 additions & 3 deletions lib/ash/resource/actions/destroy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ defmodule Ash.Resource.Actions.Destroy do
skip_unknown_inputs: [],
atomic_upgrade?: true,
atomic_upgrade_with: nil,
action_select: [],
action_select: nil,
arguments: [],
touches_resources: [],
delay_global_validations?: false,
Expand All @@ -34,12 +34,12 @@ defmodule Ash.Resource.Actions.Destroy do
type: :destroy,
name: atom,
manual: module | nil,
action_select: list(atom),
action_select: list(atom) | nil,
notifiers: list(module),
arguments: list(Ash.Resource.Actions.Argument.t()),
atomic_upgrade?: boolean(),
skip_unknown_inputs: list(atom() | String.t()),
atomic_upgrade_with: nil | atom(),
atomic_upgrade_with: atom() | nil,
require_atomic?: boolean,
accept: nil | list(atom),
require_attributes: list(atom),
Expand Down
6 changes: 3 additions & 3 deletions lib/ash/resource/actions/update.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defmodule Ash.Resource.Actions.Update do
require_atomic?: Application.compile_env(:ash, :require_atomic_by_default?, true),
atomic_upgrade?: true,
atomic_upgrade_with: nil,
action_select: [],
action_select: nil,
notifiers: [],
atomics: [],
delay_global_validations?: false,
Expand All @@ -37,8 +37,8 @@ defmodule Ash.Resource.Actions.Update do
manual: module | nil,
skip_unknown_inputs: list(atom | String.t()),
atomic_upgrade?: boolean(),
action_select: list(atom),
atomic_upgrade_with: nil | atom(),
action_select: list(atom) | nil,
atomic_upgrade_with: atom() | nil,
notifiers: list(module),
accept: nil | list(atom),
require_attributes: list(atom),
Expand Down
2 changes: 1 addition & 1 deletion lib/ash/resource/info.ex
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ defmodule Ash.Resource.Info do
Extension.get_persisted(resource, {:action_inputs, action}) || MapSet.new()
end

@doc "Returns the list of attributes that must be selected for an action invocation, or nil if the changeset select should be used"
@doc "Returns the list of attributes that must be selected for an action invocation"
@spec action_select(Ash.Resource.t(), action :: atom() | Ash.Resource.Actions.action()) ::
list(atom) | nil
def action_select(resource, %{name: name}) do
Expand Down
2 changes: 1 addition & 1 deletion lib/ash/resource/transformers/cache_action_inputs.ex
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ defmodule Ash.Resource.Transformers.CacheActionInputs do
case changes do
[] ->
dsl_state
|> Transformer.persist({:action_select, action.name}, nil)
|> Transformer.persist({:action_select, action.name}, [])

_ ->
attributes =
Expand Down

0 comments on commit f95921f

Please sign in to comment.