-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
@ngrx/entity add setOne (replaceOne?) method #2369
Comments
Note I think upsertOne should have Also every dictionary definition I've found has upsert means insert or update. |
@AdditionAddict I do not think there is any issue with As to name, i chose |
@dmytro-gokun I agree |
I think adding a |
@timdeschryver Great, i'll work on a PR |
@dmytro-gokun can you hold it off for a bit? |
@timdeschryver sure |
Sounds good to me |
Currently, the only way to replace an item is by using upsertOne. That does not work well with 'undefined' though (which is the case when the backend omits nulls when serializing to JSON). For example, i have an entity in the collection: {id: 1, name: 'foo', note: 'lorem ipsum'}. I want to replace it with {id: 1, name: 'foo'}. Obviously, upsertOne does not do the job well. Since the object is already there, it attempts to perform an update, thus treating the new object as a patch and leaving 'note' value unchanged. So, a new method 'setOne' is needed here.
Describe any alternatives/workarounds you're currently using
removeOne/addOne does the trick, but is not very efficient.
If accepted, I would be willing to submit a PR for this feature
[X ] Yes (Assistance is provided if you need help submitting a pull request)
[ ] No
The text was updated successfully, but these errors were encountered: