-
Notifications
You must be signed in to change notification settings - Fork 111
Fix issue with Unique Records not being removed when the unique fields are value fields #510
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?
Fix issue with Unique Records not being removed when the unique fields are value fields #510
Conversation
…reProperties mutating them
I'm not really happy with the way I had to do this, but because Personally I think the If you know a better way I'd be happy to hear them and update accordingly |
Alex, thanks for the work on this. I agree with the comment about mutating properties. How is this working for you in practice? I'll wait for 2 other PRs to have some test, then I'll merge this one. |
Actually I was a little worried about the code just because that Was waiting to hear back from you guys what you thought. |
We use uniqueness rarely. It does add a lot of complexity, so we use it for things that really require it like email addresses and account names. |
Our use case is ensuring unique email on user records. The issue for us is we don't want to hard delete users, we want to soft delete them. So a simple unique on Solution we found was to use a value function to set a If you think my PR is a good fix then I'm happy for you to merge it so we can turn the uniqueness back on. |
Alex, sorry for the delay in looking into this. Been swamped with other stuff. I'm concerned about the risk of change in the PR -- so that is why I've not just merged it already. I need to dig into it closely. I'll try to get to this soon. Michael |
No problem, take your time |
Just an update, digging into this now and should have feedback very soon. |
Sorry for the delay. |
See Issue #509 for all the details.
I've since taken the tests created for that issue and improved them slightly.
Changes to Model.js:
hasUniqueProperties
by also checkingparams.remove
prepareProperties
to avoid issues due to the method mutating the objects causing conflicts if run multiple times