-
-
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
[BUGFIX] has-many relationship: set hasData when fetching link #5053
[BUGFIX] has-many relationship: set hasData when fetching link #5053
Conversation
Not sure what's wrong with Travis. |
assert.equal(get(records, 'length'), 0); | ||
assert.equal(get(personsReference.value(), 'length'), 0); | ||
|
||
done(); |
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.
lets not use done
, instead use promises directly. That way when the promise rejects, the test fails.
return Ember.RSVP.resolve({ data: [] }); | ||
}; | ||
|
||
var family; |
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.
let
}; | ||
|
||
var family; | ||
run(function() { |
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.
=>
var personsReference = family.hasMany('persons'); | ||
assert.equal(personsReference.remoteType(), "link"); | ||
|
||
run(function() { |
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.
=>
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.
return
(so promises work)
assert.equal(personsReference.remoteType(), "link"); | ||
|
||
run(function() { | ||
personsReference.load().then(function(records) { |
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.
return
(so promises work)
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.
=>
@csantero this looks reasonable, but we should double check. @igorT / @runspired / @hjdivad / @bmac r? |
@stefanpenner I've updated the test. |
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.
Hmm looks okay but I wonder if we need to handle the case of preloading with an empty array as well
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.
lgtm
Looks great, thanks for the contribution @csantero |
I believe this fixes #4845. The problem is that
setHasData
was only being called when at least one internal model was being added, which is not the case when the server returns an empty array.