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 ran into this too. I believe it's related to this issue with Ember Data 2.13, not this library specifically: emberjs/data#4963
The runloop workaround in that issue thread worked for me to get a "find-or-create" working. Here's what my code looks like, inside a method whose signature returns a promise resolving to a record:
returnget(this,'store').findRecord('model-type',id).catch(()=>{// `findRecord()` created an internal model for the passed ID.// A failed lookup causes that internal model to begin destroying.// It's not guaranteed to be destroyed by the time we get here, though.// We have to schedule anything that might touch the dematerializing internal// model with this ID to happen after dematerialization in the destroy queue.returnnewRSVP.Promise((fulfill)=>{run.schedule('destroy',()=>{fulfill(get(this,'store').createRecord('model-type',{/* attrs */}));});});});
Hey, I ran into an issue with ember-data-localstorage today after upgrading to Ember-Data 2.13
The pattern I use with local-storage is usually:
I get an assertion failure:
The id 'some-id' has already been used with another record for modelClass 'local-model'.
It seems that .findRecord adds the model to the store even if it's not found.
The text was updated successfully, but these errors were encountered: