Closed SumeraMartin closed 4 years ago
It's hard. I've implemented this in the past without Store by implementing the fetcher and a separate query API:
Observable<PagedList<Data>>
which can be built from DataSource.Factory<Key, Value>
in Room's Dao
with the Paging library.SyncStatusChannel
for keeping track of status of the sync (loading, out-of-sync, up-to-date) which the UI can observe along with the data stream.Not sure if it's possible to integrate Store 4 with the upcoming Paging 3 to make this easier (being able to work with StoreResponse<PagedList<Data>>
)?
You can also subclass PositionalDataSource
This would probably work with the other implementations of DataSource<K,V> provided by the Paging library.
FYI i'm looking into this as part of Paging3 but there does not seem to be much benefit in putting store in front with the exception that it might help you cache paging across screens etc, if there is a case like it. You may also want to put store behind paging but that again really depends on how your paging works, whether data changes locally or not etc. We should keep this open until we have a recommended solution but so far i'm not sure what that will look like.
@yigit at the very least is there currently a way to 'append' data to the stream returned from an existing Key? This would allow for the 'Load More' use case.
@yigit at the very least is there currently a way to 'append' data to the stream returned from an existing Key? This would allow for the 'Load More' use case.
Answering my own question it seems the current answer would be using a persister that returns a flow so that we can have it be the source of truth and append externally to the Store APIs.
Closing, please use Paging3 on its own. Paging 3 has a multicaster built in and should serve use cases without needing store
If Store is going to be Multiplatform and Paging 3 is not covering that, can be this implemented in Store?
So Paging3 has the same caching features Store has, plus paging capabilities? Meaning that Paging3 is superior than Store, feature wise?
Hi, I'm thinking if it is somehow possible to use paged content with the Store. I want to load feed with the newest data and when the user reaches the end of the feed then I want to load older data and so on.
I know that caching of such results can be hard since items can added, or removed, or moved. So I don't know if it is possible. One solution that I figured out would be to cache only the first page and then load others but I don't know how to implement this with the Store.
Can you help me with that?
Thank you for your response