Ember queryRecord doesn't store in store


Hi, I get data like this:

promQuery = self.store.queryRecord('performance', params);
      promQuery.then(function (result) {
        obj.performance = result.get('fake');
        promQuery.obj = obj;
        self.set('data', promQuery);
      }, function (fail) {
        self.set('data', fail);

I expect that next time I call for self.store.queryRecord(‘performance’, params); data will be returned from store. But instead it comes from the server. Params are still the same… In Ember data (Chrome extension), every time I call for this data I see that it stored with different IDs.

Maybe I made something in model or serializer?



Ok… I found out… I have serializer that creates ID…

import RESTSerializer from 'ember-data/serializers/rest';
export default RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
  normalize(model, hash/*, prop*/) {
    hash.id = Ember.guidFor(hash);
    return this._super(...arguments);

If I get ID from server, the store saves the data. But I do not have an ID in the server. How to use serializer and store the data?


store.queryRecord and store.query always make a request to the backend, regardless of whether it already make a request before.

If your record doesn’t have an id, maybe it shouldn’t be a DS.Model.
Does it have anything unique that you can use as an id?


But why if I use store.queryRecord and store.query ember stores it in data if it’s always calls for backend?

Nope, there is nothing unique.


Yes. It always makes a request to make sure the data is fresh.

What are you trying to accomplish, some sort of auto-complete/search box?


I’m making some POC. Our team are all new to ember, so we try to understand how ember data works. When it stores the data and when not. I don’t find any good docs about it.

What I try to do is, get data from API and store, delete it. And measure performance of client. If I get huge data, how it affects to the client’s memory.