Skip to content

Commit

Permalink
Fix actions hook
Browse files Browse the repository at this point in the history
  • Loading branch information
tfwright committed Jan 29, 2024
1 parent c15ca62 commit 8a8668a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/live_admin/components/resource/index.ex
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,6 @@ defmodule LiveAdmin.Components.Container.Index do
) do
records = Resource.all(ids, resource, prefix, repo)

action_name = String.to_existing_atom(action)

results =
records
|> Enum.map(fn record ->
Expand All @@ -358,9 +356,8 @@ defmodule LiveAdmin.Components.Container.Index do
resource
|> LiveAdmin.fetch_config(:actions, socket.assigns.session)
|> Enum.find_value(fn
{^action_name, mfa} -> mfa
^action_name -> {resource, action_name, []}
_ -> false
{action_name, mfa} -> to_string(action_name) == action && mfa
action_name -> to_string(action_name) == action && {resource, action_name, []}
end)

apply(m, f, [record, socket.assigns.session] ++ a)
Expand Down

0 comments on commit 8a8668a

Please sign in to comment.