-
-
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
Can't return null to queryRecord anymore #4310
Comments
Thanks for reporting this @danconnell. What adapter are you using? Can you provide an ember-twiddle, demonstrating the issue? You can use this twiddle as a start, it uses the |
Ah now I can reproduce the issue you're having. I had it wrong, and in the twiddle
|
I'm using the rest adapter. Tested on 2.5.0-beta.3 and it's still broken. Here's a twiddle using 2.5.0-beta.3. |
Looks like this is a regression. There is no assert throwing in v2.3.3 but in v2.4.3 there is. The assertion has been added in #3916, because at that time a not very descriptive error |
This has been discussed in the team meeting and the assertion for |
Sounds good. Thanks for the update :) |
same error Assertion Failed: You made a because at that time a not very descriptive error You must include an 'id' for undefined in an object passed to 'push' would be thrown if the payload was empty. |
@BissyQA yes, this is addressed in #4300. Until the PR is merged and a new release is cut, you can work around this by ensuring that you don't return an empty object as payload from the adapter, as shown in this ember-twiddle: import DS from "ember-data";
export default DS.RESTAdapter.extend({
queryRecord() {
return this._super(...arguments).then(function(payload) {
// workaround so returned payload is not empty, remove
// once https://github.com/emberjs/data/pull/4300
// is merged and released
payload._unusedKeySoPayloadIsNotEmpty = {};
return payload;
});
}
}); |
I am going to close this issue since #4300 has been merged and the regression has been fixed in that PR. |
Previously on Ember Data 2.3.3, you could have you API return null to a call made by
queryRecord
. Now, on Ember Data 2.4.3, you get this error if you try to do that:Assertion Failed: You made a
queryRecordrequest for undefinedrecords, with query
[object Object], but the adapter's response did not have any data Error: Assertion Failed: You made a
queryRecordrequest for undefinedrecords, with query
[object Object], but the adapter's response did not have any data
Was this an intended change? I understand that this might not be a bug, but I also don't see this change mentioned in the changelog.
Just thought I should point it out, since it did break something for me.
The text was updated successfully, but these errors were encountered: