Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preload_actions #2

Open
olafbado opened this issue Jun 14, 2023 · 0 comments
Open

preload_actions #2

olafbado opened this issue Jun 14, 2023 · 0 comments

Comments

@olafbado
Copy link
Contributor

olafbado commented Jun 14, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant