Mostly looking for inspiration with this because I...
# squarelibraries
e
Mostly looking for inspiration with this because I don't think there's one true answer, and I don't think this is really Molecule's domain. I'm using Molecule as a presenter to gather state to send to my view (using UDF). User actions on the views are modeled in a
Flow<Intention>
back to the presenter and used to drive certain state changes (or launch coroutines to do work depending on the intention). I also have the concept of
Effects
which are things that happen as side effects to a screen being opened (logging analytics, etc...). The issue is that some Effects end up needing interaction with the user. For example, when a certain screen opens, its Effect starts running a migration under certain conditions. However if that migration fails, I show the user a dialog asking if they want to retry it or skip it. That intention feeds back into the Effect determining if the migration should be retried or not. I've solved that until now by introducing
Sources
which are basically shared mutable state between the Effect and the presenter. But after using it for a few weeks the line between Effect and presenter started blurring. Today it came to a head when I needed to do a combine on two flows in the Effect, and found myself wishing that the Effect used Molecule as well, aside from the fact that Molecule doesn't really fit into what an Effect does. Any suggestions on how to handle this in a Molecule world?
1