You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
push returns a single model for objects and an array of records for arrays, so if the response is a collection of records instead of a single record the result of queryRecord will be a collection. The documentation implies that this function will always return a single record.
If the position of the ember-data team is to say "the endpoint should return a single record" I'd like to challenge this.
The url being built by queryRecord is identical to the one being built by query. From the backend's perspective there may be little control over how to shape the response, even if we assume one of the query criteria to force a unique response. I would advocate for queryRecord to force a collection from push to return firstObject.
The text was updated successfully, but these errors were encountered:
We must have something else going on, it appears that normalizeSingleResponse will force all records not firstObject into the included key which satisfies this issue.
https://github.com/emberjs/data/blob/master/addon/system/store/finders.js#L193
push returns a single model for objects and an array of records for arrays, so if the response is a collection of records instead of a single record the result of
queryRecord
will be a collection. The documentation implies that this function will always return a single record.If the position of the ember-data team is to say "the endpoint should return a single record" I'd like to challenge this.
The url being built by
queryRecord
is identical to the one being built byquery
. From the backend's perspective there may be little control over how to shape the response, even if we assume one of the query criteria to force a unique response. I would advocate forqueryRecord
to force a collection frompush
to returnfirstObject
.The text was updated successfully, but these errors were encountered: