I need to understand once for all why property like
isSettled
isPending
isFulfilled
are different if I'm including or not the data in my API respone.
I'm asking here this: http://ift.tt/2n6Za4d which leads me to this strange behaviour:
If I include in my API responde the data (ex: model.posts
) these properties are immediately set to true (and .isPending
to false) also if Chrome is still loading the real data (also for the first time!).
And this is a problem because I don't know if the posts[] are empty or not and I don't know what I can spy because something like that doesn't work:
My posts.
<div>Loading...</div>
<div>Nothing to show.</div>
It's always "Nothing to show." until Chrome loads. Because .isPending
is immediately false.
Also if I use the length attributes:
because the starting posts[] array and the empty one is always to length == 0.
If I loads posts differently, async, not sideloaded (but with hundreds HTTP requests, which I don't want) it works. Ember recognize an isPending
...
Why this strange behaviour?
Aucun commentaire:
Enregistrer un commentaire