-
Notifications
You must be signed in to change notification settings - Fork 23
Description
I don't know if this is something that should be mentioned in the readme but data
is private api and shouldn't be used.
I got stung by it after using the data links directly in my templates for using a media link that is rendered in an image, i.e. {{my-image src=obj.nested.data.links.media}}
.
The problem is that the data
, which is an readonly alias for its internal model _data
is converted by ember to an ember object with __ember_meta__
, setters, getters and much more. That means the internal model is now an ember object (which is pretty bad).
This breaks pushing an already loaded record to the store (i.e. by ember after an store.find) because it tries to merge the stored record with the new incoming record. This happens without calling Ember.set
which causes the ember added setter to throw an error because it needs to be invoked with Ember.set
I solved this for myself by adding a links attribute links: attr()
to all my models and reading the links
values from that attribute. ({{my-image src=obj.nested.links.media}}
).
This could be redundant if warp-drive-data/warp-drive#2905 is fixed (warp-drive-data/warp-drive#3419)