Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 26 2016 19:45
    guilhermeaiolfi commented #322
  • Apr 26 2016 19:33
    k2s commented #322
  • Apr 26 2016 19:28
    jmdobry commented #322
  • Apr 26 2016 19:13
    k2s commented #322
  • Apr 26 2016 19:07
    guilhermeaiolfi commented #322
  • Apr 26 2016 12:12
    k2s opened #322
  • Apr 26 2016 04:36
    jmdobry synchronize #264
  • Apr 26 2016 04:36

    jmdobry on v3

    Improved JSDocs (compare)

  • Apr 24 2016 17:53
    remicastaing commented #321
  • Apr 24 2016 17:53
    remicastaing closed #321
  • Apr 24 2016 17:35
    jmdobry labeled #321
  • Apr 24 2016 17:35
    jmdobry commented #321
  • Apr 24 2016 14:23
    remicastaing opened #321
  • Apr 23 2016 22:57
    jmdobry synchronize #264
  • Apr 23 2016 22:57

    jmdobry on v3

    Improved JSDocs (compare)

  • Apr 23 2016 08:19
    jmdobry synchronize #264
  • Apr 23 2016 08:19

    jmdobry on v3

    Improved JSDocs (compare)

  • Apr 22 2016 08:41
    jmdobry edited #320
  • Apr 22 2016 08:41
    georgi-kovachev closed #320
  • Apr 22 2016 08:41
    georgi-kovachev commented #320
Sisir
@prionkor
so server side only respond for the given field.
have a nice weekend. I will manage through the weekend. no more mentioning you. I will keep this chatbox updated. So, if you have time you could check it asynchronously. Thanks again for your great help!
Grégory Copin
@Gregcop1
Ok, no problem. I hope you'll find the best solution for your project
Sisir
@prionkor
did you face this issue? When I get data using findAll() it return data from REST api but on the next query because previous query is cashed it doesn't send api request but doesn’t return the data from cache either. it returns empty array
Sisir
@prionkor
How do I get non resource data. For example I have homepage of the application where I need a bunch of data like uses stat, total numbers of blog posts etc.. those information aren't like resources (articles, users etc). How do I make those enpoints? For example /dashboard-data
Grégory Copin
@Gregcop1
Hi
Do you need those data to be stored on cache ?
do you really need js-data for that ?
Sisir
@prionkor
my main goal was to find a data layer that manages my data from server, caches appropriate
to reduce redundant request
the json schema in js data is a good feature
Grégory Copin
@Gregcop1
that's why at first I was asking you if all your endpoint are restFull
In my apps, I manage everything with Resources (which extend an AbstractResource)
those resources are instanciate with some options (use cache, cache lifetime, etc...) and instanciate js-data resource when needed of make direct GET call via axios for non-restFul request
Sisir
@prionkor
I am creating backend api as I move forward so if anything needs to be created I am okay with that
Sisir
@prionkor
my immediate problem is to solve the empty data return form js-data. for example store.findAll('article', {_limit: 50, _offset:0}) calls server first time but on second time it doesn't call the server and returns empty array []
Grégory Copin
@Gregcop1
Mmm I never had this problem
Have you checked your indexeddb/localstorage (dunno where you store your cache) to watch if data are stored after the first call ?
Sisir
@prionkor
not using any kind of storage. Its storing in the variable (RAM)
Grégory Copin
@Gregcop1
ok, so you should be able to watch store state in the console of your browser
you have some example in the doc of jsdata
Sisir
@prionkor
let me check
got it..
I will get back to you soon
Grégory Copin
@Gregcop1
ok
Sisir
@prionkor
oh okay, so here is the problem I was facing. When i do store.findAll() it always calls server. For second time it doesn't return from store..
Sisir
@prionkor
this is what findAll() suppose to do. I guess my problem is to switch between findAll() & getAll()
Grégory Copin
@Gregcop1
it's supposed to do the job himself
if cache is activated, js-data checks in its memory and if the cache has expired it ask to adapter
Sisir
@prionkor
const dataStore = new DataStore({
    useFilter: true,
    //maxAge: 60 * 60 * 1000, // one hour max age
});
this is how I am initializing datastore
Grégory Copin
@Gregcop1
can you try a maxAge to 1ms
just for test
I'm sorry, I don't use js-data everyday. When it's well configured for a project you don't have do return to it anymore :)
Grégory Copin
@Gregcop1
can you try the option "force"
store.findAll('post', {}, { force: true });
it's supposed to bypass cache
Sisir
@prionkor
note, I am not getting the empty array
it always calls server and returns data
sorry about the confusion it does..
trying the force now
So, Here is the problem (no confusion now >_< )
Sisir
@prionkor
when I have empty query it doesn't have problem.. ( calls server frist time, loads from cache next time)
when I have query then it have the problem..
store.findAll('post', {}, { force: true });  // without query no problem
store.findAll('post', {parent:null, _limit: 50, _offset: 1});  // without query problem, empty array when loads from cache.
Sisir
@prionkor

Found a workaround..

First I try the sync methods like store.filter() to get data. If data is empty ( meaning never queried before) then call findAll()

:)
Alex Alexandrov
@rapidexact
Hi all.
I have a question.
If i invoke find, or findAll methods from few places at same time, then i will get few requests to server, or one request ?
Olson3R
@Olson3R
@rapidexact My thoughts are... Due to the nature of JavaScript/Node, the requests will not happen at the same time since it is single threaded. If the requests are similar enough, the first request might get sent and the response stored in the data store. Subsequent requests might be satisfied with the data in the cache and not require external api calls.