-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
make DS.ManyArray lazy #4600
make DS.ManyArray lazy #4600
Conversation
We should add a test that verifies it is indeed lazy |
}; | ||
|
||
HasManyReference.prototype.push = function(objectOrPromise) { | ||
return Ember.RSVP.resolve(objectOrPromise).then((payload) => { | ||
return resolve(objectOrPromise).then((payload) => { | ||
var array = payload; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should likely return if the HasManyReference is destroyed by now (assuming it can be destroyed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have eventually the same problem with belongsTo
. I think it's best to create an issue and make a separate PR to fix it (if it's really a problem). I have not changed anything significant in this PR regarding references.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, open an issue and link back here, so we can address.
Based on measurement this leads to a 15%+ speed improvement when loading hasMany relationships. (one of the scenarios with 5 hasMany's showed a 50% improvement) |
ab86a7f
to
9ac1df9
Compare
@igorT test added |
9ac1df9
to
2ff2107
Compare
This causes a perf issue and breaking apps using glimmer (which detects this scenario) Specifically, when a relationship is lazily consumed it should not have side-affects, such as invalidating itself. POC fix to unblock: #4643, but working on a more comprehensive one. |
This is mostly @igorT typing on my keyboard :)