EmbeddedRecordsMixin and sideloading

Hello all,

I’m wondering if the EmbeddedRecordsMixin currently works with combining embedded and sideloaded relationships, using for example this (ActiveModelSerializer-ready) JSON:

{
    home_planet: {
      id: "1",
      name: "Umber",
      super_villain_ids: ["1"]
    },
    super_villains: [{
      id: "1",
      first_name: "Tom",
      last_name: "Dale",
      home_planet_id: "1",
      evil_minions: [{
        id: "1",
        name: "Alex"
      }]
    }]
}

I’ve got a failing test here: https://github.com/tobymarsden/data/blob/master/packages/activemodel-adapter/tests/integration/embedded_records_mixin_test.js#L80-121

Failure:

1. okay
2. okay
3. Should load the embedded child
Expected: 	
1
Result: 	
0

4. Should load the embedded child
Expected: 	
"Alex"
Result: 	
undefined

But I’m not sure whether it’s that EmbeddedRecordsMixin doesn’t support this use case, or (quite probably) I haven’t set the test up correctly…?

Thanks!

1 Like

@tobymarsden your test does look setup properly, perhaps the EmbeddedRecordsMixin does not support embedded in side-loaded objects.

I noticed the same behavior with ember-data 1.0 beta8.

It is intended or a bug? Personally, I would expect that when I declare a record as deserialize: records it will work on sideloaded objects as well…

@nandosan perhaps try ember data canary I think the issue with side-loading and embedded records is already fixed (could be wrong).