Skip to content

preload_actions #2

@olafbado

Description

@olafbado

If I understand correctly, preload_actions callback allows the user to specify which actions will be preloaded with resources but the preload_actions definition will include some default actions ([:show, :edit, :update, :delete, :index]) even if we pass one action, for example we want to preload only on :show action, so we should pass this action to preload_actions but it will append default actions to that making :show action duplicated ie. [:show, :show, :edit, :update, :delete, :index]

My suggestion is to return a list of preload actions provided by user and not include additional routes.

preload_actions callback definition:

@impl true
def preload_actions do
preload_actions = unquote(opts_preload_actions)
case preload_actions do
nil -> [:show, :edit, :update, :delete, :index]
list when is_list(list) -> list ++ [:show, :edit, :update, :delete, :index]
end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions