-
-
Notifications
You must be signed in to change notification settings - Fork 407
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
Add support for nested saves #173
Conversation
igor changes
- small editing - expand "scenario solving"
@hjdivad @igorT I'm thrilled to see this RFC! 🏅 Of all open issues in Ember Data this is the one with the most comments (not counting duplicates). So it's definitely something that would bring joy to a huge amount of Ember Data users! Some thoughts:
Your question: “Are there issues with transitioning nested saved objects to an invalid state even in cases where the nested object itself did not have errors?” I don't see any problem with this. |
Although both
After some discussion, this RFC will be reworked slightly to move
Yes. Your serializer will need to ensure that |
@hjdivad I was mainly throwing the idea out there (id-naming). If you prefer Moving |
Is there a timeline for this? Can this be brought up for discussion on being added to the timeline? |
is anyone working on this? I might be interested in tackling some of this. |
@robneville73 nobody is working on it at the moment, but everyone's pretty positive on the idea. The first step is to rework the rfc (slightly) to make the mechanics entirely an adapter concern.
|
I can fork your rfc and try to do that if you'd like though I'm a little fuzzy on what you mean by entangling in snaphot via adapter. |
Basically think through how to change the example when you don't have I imagine the way this would work is that the parent object will be Something like // models/order.js
DS.Model.extend({
items: DS.hasMany('items'),
});
// routes/order.js
Ember.Route.extend({
actions: {
saveOrder(order) {
order.save();
}
}
});
// adapters/order.js
DS.Adapter.extend({
createRecord(store, modelClass, snapshot) {
snapshot.belongsTo('items').forEach(itemSnapshot => {
// this would transition `itemSnaphot.record` and entangle `itemSnapshot` with
//`snapshot` such that when the order's record transitions away from in flight,
// so does the item's record
itemSnapshot.savedWith(snapshot);
});
}
}); Does that make sense? |
Closing. Of the three items this RFC is concerned with, two are handled by the merged identifiers rfc. The remaining item is an API for co-mingling record lifecycles for multiple records with one promise (whether nested saves, or optimistic changes based on knowing the semantics of a particular API) which we'd prefer to do as a separate rfc. |
Rendered