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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix propagating post-save mutations #2524
Fix propagating post-save mutations #2524
Conversation
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.
Thanks for the contribution @booleangate! The changes look good.
Please, fix the minor suggestions and I'll merge this PR. Also note, that the changes need to be applied on the other hook types as well (update, update-one, etc). Would you like to contribute them in different PRs?
}, ent.OpCreate)) | ||
|
||
u := client.User.Create().SetName("a8m").SetVersion(1).SaveX(ctx) | ||
require.Equal(t, u.Version, 2, "version mutation in hook should have propagated back to call site") |
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.
馃挴
Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
@a8m I'm afraid I don't follow but I'm happy to learn. The signature on the update and delete clients is |
Let's start with update-one - https://github.com/ent/ent/blob/master/entc/gen/template/builder/update.tmpl#L200-L202 |
CI is red. Please, run |
@booleangate can you rebase your branch on master and create a new PR? |
@a8m yup, working on a new PR now with the UpdateOne changes. |
This addresses the bug I reported in #2523. I've broken commits up so you can review just the first two in isolation (a failing test, and the fix) to cut out all the noise from the regeneration.
馃摀 I had to branch my changes off of the fix/bump-atlas branch in order to be able to run
go generate ./...
. I'm just waiting for that to merge, then I'll rebase.