Zhuinden / realm-monarchy

[ACTIVE-ISH] A wrapper over Realm which exposes it as LiveData, managing Realm lifecycle internally.
Apache License 2.0
88 stars 11 forks source link

Entire data from the DB is getting loaded into pagedlist. Is it not honoring the page size in Monarchy? #27

Closed ksyamkrishnan closed 5 years ago

ksyamkrishnan commented 5 years ago

Entire data from the DB is getting loaded into pagedlist. Is it not honoring the page size in Monarchy? `public List loadRange(final int startPosition, final int count) { final int countItems = countItems(); if(countItems == 0) { return Collections.emptyList(); } final List list = new ArrayList<>(count); monarchy.doWithRealm(new Monarchy.RealmBlock() { @Override public void doWithRealm(Realm realm) { RealmResults results = (RealmResults) monarchy.resultsRefs.get().get(liveResults); for(int i = startPosition; i < startPosition + count && i < countItems; i++) { // noinspection ConstantConditions list.add(realm.copyFromRealm(results.get(i))); } } });

        return Collections.unmodifiableList(list);
    }`
Zhuinden commented 5 years ago

Hmm? What do you mean? It definitely shouldn't be loading ALL items at once.

It should be loading a page amount, as it is read from Realm with that for { loop.

ksyamkrishnan commented 5 years ago

ok. I was not setting the value for InitialLoadSizeHint. Because of that, it was taking the first 3 pages by default.