I seem to have a recurring problem when i'm trying to store data using ember.
When i clear my localforage (Chrome Dev Tools -> tab Application) and reload my application, I create a series of request to my API and with the results of those API calls I create and store them in my localstorage.
Oftentimes, right after i cleared my storage i get the following warning:
Ember Data expected to find records with the following ids in the adapter response but they were missing: [1,2]
After that, I get an error
Assertion Failed: The id 1 has already been used with another record for modelClass ocularium-frontend@model:application-settings:
This should never happens since I've cleared my storage and did a refresh. He finds data that's there but actually not there.
Is there a way to fix this and actually save the data? I tried catching it and storing it again. Tried to 'update' it and storing it again, didn't work.
Normally, I get an API response with valid JSON. Ember then uses a model like below, to save it to the store. The model has the same name as the store-type, in this case "application-settings"
import DS from 'ember-data';
export default DS.Model.extend({ name: DS.attr() });
And then to save it I use this code where 'storeKey.type' = "application-settings" and data = the new data.
this.store.createRecord(request.storeKey.type, data).save();