-
-
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
Entity upsert wrongly documented + typing issue #818
Comments
This is an issue with our docs. You are correct that the type signature is |
Is this by design or by accident? I figured I would just pass the entity to the API and it would be handled behind the scenes. For now I agree it is a docs issue, however I think the API consumer shouldn't pass an #817 Seems to agree.
|
I like the way the upsert is being described in the docs:
IMO, upsert is an insert that silenty updates existing entities. The API for this should be closer to "add" than to "update". Using upsert with the current API will probably always look like this:
The Thank you! |
I have the same idea too. But there was a long discussion and everyone have agreed that upsert should have the same signature with update so I made PR following that. #421 |
I'm having an issue with the typing too. When an Object of get's updated in the state, the type is lost and it's just an Object |
@miniplus can you reopen this issue? |
I'm submitting a...
What is the current behavior?
User
vsUpdate<User>
). See reproductionapp/user.reducer.ts#14
& app/user.reducer.ts#18.upsertOne
orupsertMany
as documenten in Medium Blogpost or github docs. Instead a type ofUpdate<Entity>
is expected (which is in the form of{id: number; changes: Partial<Entity>}
(See reproduction example)Possibly related to #817.
Expected behavior:
User
vsUpdate<User>
Minimal reproduction of the problem with instructions:
https://stackblitz.com/edit/ngrx-upsert-bug
Version of affected browser(s),operating system(s), npm, node and ngrx:
ngrx store / entity 5.1.0
The text was updated successfully, but these errors were encountered: