adopted-ember-addons / ember-data-model-fragments

Ember Data addon to support nested JSON documents
MIT License
370 stars 114 forks source link

Fix #316 polymorphic create fragment #483

Closed dwickern closed 8 months ago

dwickern commented 8 months ago

I fixed the merge conflicts from #436 and got it working with the new RecordData implementation.

Fixes #316 Closes #436

dwickern commented 8 months ago

There seems to be a problem still with polymorphic values in fragmentArrays when using createRecord:

const zoo = store.createRecord('zoo', {
  star: { $type: 'lion' },
  animals: [{ $type: 'lion' }, { $type: 'elephant' }],
});
zoo.star instanceof Lion; // true ✅
zoo.animals.firstObject instanceof Lion; // false ❌
zoo.animals.lastObject instanceof Elephant; // false ❌

Edit: resolved by 15fac61a31126f94094e5872c4f71a78e451b488

knownasilya commented 8 months ago

@dwickern ready for review?

dwickern commented 8 months ago

@knownasilya ready for review 👍

dwickern commented 8 months ago

@knownasilya any plans to release this fix?

knownasilya commented 8 months ago

@dwickern released