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.
should likely return if the HasManyReference is destroyed by now (assuming it can be destroyed)
There was a problem hiding this comment.
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.
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 :)