Store: What's wrong with stream or how to use it properly?
Let’s review this simple example
fun fetchFromCollection(keys: Set<MySerializedType>){
someNonblockingScope.launch {
for(key in keys) {
myStore.steam(StoreRequest.cached(key, true)).collect {
if (it.origin == ResponseOrigin.Fetcher && it !is StoreResponse.Loading)
Log.d("CHECKING TRIGGER", "$key triggered")
}
}
}
}
the expected outcome should be that CHECKING TRIGGER will trigger once for each unique key even if fetchFromCollection executed several times (each time always unique keys)?
If I execute fetchFromCollection with one unique set of keys it will run as expected, but if I execute second time fetchFromCollection with another different set of keys it will trigger CHECKING TRIGGER condition more than once(new set of unique keys).
What I miss? Why it doesn’t work as expected?
And then if execute fetchFromCollection three, four times and so on each time with new set of keys stream will just hang with Loading state forever.
I pushed this example project demonstrating the issue in full scale.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (8 by maintainers)
Correct coordinate is
com.dropbox.mobile.store:filesystem4:4.0.0-alpha02.For file based persister, you can check out
com.dropbox.mobile.store:filesystem:4.0.0-alpha02It’s definitally not as well supported asstorebut might be good for your needs.