Breeze / breeze-client

Breeze for JavaScript clients
MIT License
38 stars 16 forks source link

child collection not updated upon server response #58

Closed graphicsxp closed 3 years ago

graphicsxp commented 3 years ago

I am not sure if I'm doing something wrong or if this behavior is "by design".

Let's say I have Order entity that holds a collection of Product as a navigation property.

1) I fetch Order by id with an expand on Product collection 2) In the database, I manually delete some Product records and I create new ones before assigning them to my Order entity 3) I repeat step 1).

In the network payload I can tell that the collection of Product returned from the server does NOT contain the Product entities removed from DB. It does contains the new ones + the ones that were not deleted.

However, now on the client side, the Order entity contains all the Product entities that were loaded the first time + the new ones. The one that were removed from DB are still in the client-side collection.

Do i have to manually diff the existing collection with the one coming back from server and detach them myself ?

steveschmitt commented 3 years ago

See my StackOverflow answer here.

graphicsxp commented 3 years ago

I understand. I think I never had this issue before because in past projects I've always used soft-delete.

Thank you for your help.