You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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}}).
I noticed this yesterday during an upgrade. I am unsure what the approved public API would be to grab links from the underlying internal model, but we should figure out a path forward if we can...
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 withEmber.set
I solved this for myself by adding a links attribute
links: attr()
to all my models and reading thelinks
values from that attribute. ({{my-image src=obj.nested.links.media}}
).This could be redundant if emberjs/data#2905 is fixed (emberjs/data#3419)
The text was updated successfully, but these errors were encountered: