-
Hey! So this idea just came to me because I was thinking about ViewEnvironment and how it allowed you to pass down values to nested screens. Kind of like how CompositionLocal works in compose? Then I checked out the code and saw that its actually UI related (doh, the name does state View even). Anyhow, the reason I was thinking about this: If I have a So with that said, remove the view from ViewEnvironment and you have Environment. This is something that I suppose would live in the context, so you can do context[ProfileKey] or something akin to that. I think this would be amazing, because if you have a promise of a non null value, then you - or me, in my case - get to query the profile in my root workflow, show loading until its ready, then pass it downstream! And in every nested workflow, I can just do context[ProfileKey] to get it. Downsides?
Happy to see some discussions around this! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
This comes up a lot. We actually don't want something like |
Beta Was this translation helpful? Give feedback.
This comes up a lot. We actually don't want something like
ViewEnvironment
for the workflow runtime because it's a poor solution for the kinds of problems that are solved very well by DI systems like Metro, Dagger/Anvil or Hilt. An environment approach would encourage creating hard to debug runtime problems that are much better handled at compile time by libraries like those.