-
-
Notifications
You must be signed in to change notification settings - Fork 328
fix: added bulk_action_ref for changeset lookups #2411
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
base: main
Are you sure you want to change the base?
Conversation
ce86c98 to
fa4f2cb
Compare
|
I believe the last thing we want to do is make sure that this key is cleared from any resulting record's metadata. |
done plus test |
wip formatting and dialyzer wip removed find_changeset_by_id_fallback linting
|
We're close! Thank you so much for bearing with me on this one. |
e0018e2 to
c2136df
Compare
Appreciate (and understand) the thorough review :) Updated and also opened ash-project/ash_postgres#645 and ash-project/ash_sqlite#189 ( It passes my repro test, please review |
lib/ash/actions/update/bulk.ex
Outdated
| |> Ash.Changeset.prepare_changeset_for_action(action, opts) | ||
| |> Ash.Changeset.set_private_arguments_for_action(opts[:private_arguments] || %{}) | ||
| |> Ash.Changeset.put_context(context_key, %{index: index}) | ||
| |> Ash.Changeset.put_context(:bulk_update, %{index: index, ref: ref}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to use the context_key variable here and make sure we aren't hardcoding it.
lib/ash/actions/update/bulk.ex
Outdated
| :destroy -> | ||
| {:bulk_destroy, :bulk_destroy_index} | ||
| end | ||
| context_key = :bulk_update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to switch on action.type so that this uses the action type for these three values. For destroys the context key, metadata key, and ref_metadata_key need to be based on the action type.
removed unnecessary find_changeset_by_index
Contributor checklist
Leave anything that you believe does not apply unchecked.
Otherwise as discussed @zachdaniel (I presume)