Do you have a sample I can look at?
# store
m
Do you have a sample I can look at?
a
i can try to create one that reproduces
t
I would fetch only once in LaunchImpressionEffect. If you need a flow then you could delay the flow collection after the a successful fetch in LaunchImpressionEffect.
a
Feels a bit like an anti pattern to me and against the nature of circuit/store
I think I am adding a check in my repo layer to get local result in case of an error instead of fetching automatically
what i can do is to keep the flow active for an additional 5 seconds before restarting, this way the error respone will be kept
this would go in my repo layer of course
@Matthew Ramotar
I use something like this which works pretty well, it uses another flow that just returns the error again as a response instead of the one from my interactor. any thoughts on this @Matthew Ramotar?
m
Where is this being used?
a
in my presenter
m
I think your approach of managing the error state and deciding when to retry is on the right track. But I'd generally recommend baking it into the repository layer. I think your repository layer should abstract Store implementation details and control retry behavior. Once the repository is set up that way, the presenter's job is just to collect from the flow and render whatever is emitted
a
I agree, but then I’d need to collect errors and and keep track of the requests by their id right? Using this on presenter level makes it a bit cleaner imo. Ideally you would bake this into the repo, I’m actually surprised I haven’t seen anybody doing this in their samples
m
It's hard for me to say without seeing your actual code and how your presenter fits with your repository, but in general I'd recommend separating data loading out of the presenter
a
okay one sec, i try to collect the snippets
the interactor is a SubjectInteractor, we expose a single observable that flatMaps the params to the actual flow of the repo
i could also do something like this but then again, i would need to do this for every single function right?
which one do you prefer?