@mattmcmanus wrote:
So I’ve got an app that throws this warning ALL THE TIME:
vendor.js:17426 WARNING: You pushed a record of type 'app-page-person' with a relationship 'page' configured as 'async: false'. You've included a link but no primary data, this may be an error in your payload. EmberData will treat this relationship as known-to-be-empty.
Here is my scenario and my expectation:
- My app is viewing a particular
page
. Thepage
is in the store and loaded.- On the page, I do a fetch to my JSONAPI endpoint to grab
app-page-person
records<url>/app-page-people?filter%5Bpage-id%5D=5344a64b-1394-4885-8f2b-ddd6e927025a&include=person.image
- Note: I’m not using the built in ember-data fetching. All relationships are set to
async: false
and I’m doing the query on my own throughstore.query
- The resulting payload is pushed into the store. It includes the linkage data for the
page
without the full model, because I already have it.... { "id": "00fafeee-6c9d-4bd2-9108-eb5a7c11ca57", "type": "app-page-people", "links": { "self": "https://www...." }, "attributes": { "sort-order": 34 }, "relationships": { "page": { "links": { "self": "https://www.....", "related": "https://www....." }, "data": { "type": "pages", "id": "5344a64b-1394-4885-8f2b-ddd6e927025a" } }, "person": { "links": { "self": "https://www.....", "related": "https://www...." }, "data": { "type": "people", "id": "00fafeee-6c9d-4bd2-9108-eb5a7c11ca57" } } } }, ....
- I receive the above warning
My assumption
My expectation here is that since the page model is already in the store, things should be fine. I don’t understand why ember-data feels the need to warn every time.
Some more details
Page Model
export default DS.Model.extend({ ... appPageProfiles: DS.hasMany('app-page-profile', { async: false, inverse: 'page' }), ... })
AppPagePerson Model
export default DS.Model.extend({ ... page: DS.belongsTo('page', { async: false }), ... })
Posts: 1
Participants: 1