2

I am working on an Ionic tab app and i am using YDN database. I noticed that most of the lists take a while before they are rendered to the screen.

i initially thought it was the YDN database query that was slow but that is not the case. if i add a console Log on completion of the YDN query,i notice that the query is not slow at all.

ydb.getAllQueryable(Feeds_DB_STORE_NAME).order('utcdate').reverse().list(10).done(function(feeds){
  console.log('REFRESH->Finsihed getting feeds: '+ JSON.stringify( feeds[0]));
  $scope.feeds = feeds;


});

But, the binding takes a long time, sometimes as much as 12seconds or more. I am only returning a max of 15 items from the database. And even when i change the query to return only 1 item, it still takes a long time.

I have tried using indexeddb directly before and i didnt have this problem, but indexeddb didnt work on Android <4.4, even though it worked on Windows Phone.

Layinka
  • 405
  • 1
  • 4
  • 13

1 Answers1

3

I had an example for AngularJs with YDN-DB. I don't see any delay update using $socpe.apply() to request immediate refresh to AngularJs process cycle. In your native implementation, q promise resolve method will automatically tick process cycle, so you don't have to.

Kyaw Tun
  • 12,447
  • 10
  • 56
  • 83
  • That Must have been it, i wrapped my call with $scope.apply() and it seems to be working now. Thanks – Layinka Aug 21 '14 at 11:14
  • Also, i suppose the promise model of YDN must hvae conflicted a little with that of angular, and thats why angular couldnt detect the change – Layinka Aug 21 '14 at 11:17
  • No. AngularJS framework put magic to its q.promise library. There is no other way around. – Kyaw Tun Aug 21 '14 at 12:34