Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4870

Strange behavior with findAll and peekAll in emberjs 4.12

$
0
0

Hi

I am in the process of upgrading my app from emberjs 3.28 to 4.12. Besides all the deprecations, I have another problem that is not present with 4.11.

Right after login I do the following in my index route:

[...]
@inject store;
async model() {
  let c1 = await this.store.findRecord('client', 'valid id');
  let clientsFind = await this.store.findAll('client');
  let c2 = this.store.peekRecord('client', 'another valid id');
  let clientsPeek = this.store.peekAll('client');
  console.log('index.model', {c1, clientsFind, c2, clientsPeek});
}
[...]

c1 and c2 contain the correct model, but clientsFind and clientsPeek are an empty array. In the developer console, I can see the /clients query, which returns ALL the data.

What’s even stranger is that when I reload the page, findAll and peekAll suddenly return the array with all the data. But without the reload findAll also returns an empty array at another route.

As I said, with 4.11 there is no problem. So what is happing here?

I don’t know if it matters, for login I use ember-simple-auth and ember-simple-auth-token.

Thanks for your help

4 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 4870

Trending Articles