mardi 7 février 2017

trouble accessing 'some' async data in Ember

this is with "ember-data": "~2.11.1"

I've got a channel model which includes 'outputs'

`outputs: DS.hasMany('output', {
    async: true
}),`

and the output model includes 'identity'

`channel: DS.belongsTo('channel'),
identity: DS.belongsTo('identity', {
    async: true
}),`

in the route of the output (which is below the channel), i doing this in the model

`model() {
    let channel = this.modelFor('channel').channel
    let outputs = channel.get('output')
    return Ember.RSVP.hash({
        channel: channel,
        outputs: outputs
    })
}`

and that is letting me see all the outputs the belong to the channel, as expected.

where I am having a problem is the identities belonging to an output.

now the identities can be shared by the outputs, so for example an identity might be 'youtube' and there might be 3 outputs with the same 'youtube' identity

what I'm seeing is that the one of those outputs has the 'youtube' identity details but the other 2 outputs are seeing .get('identity') to be null.

Have i set model or model hook incorrectly? Or is it doing something to stop me from retrieving the identities again (some kind of caching?)




Aucun commentaire:

Enregistrer un commentaire