So it seems ambient doesn’t have an @Model annotation, like state does
how can I shim that in?
Why would I do it like that? I need the RouterSwitch component to recompose
r
Ryan Mentley
10/29/2019, 12:30 AM
You need the
Stack
to recompose - the
RouterSwitch
isn't actually using the history value
but hmm, I'm not 100% sure what our current strategy for comparing lambdas is - I'd expect it to either recompose the Stack on ambient changes because it recomposed the parent and it passed a new lambda, or to fail to detect changes to the block, with my guess being the former
but either way, you definitely shouldn't need to read the ambient outside of the Stack
a
andrew
10/29/2019, 12:36 AM
If it helps, my History class has a model, and I don’t think the ambient will recompose anythingg
t
themishkun
10/29/2019, 4:55 AM
@andrew why would you need the history as an ambient? You can just pass it to the top level composable which can decide based on this data which screen should be visible
a
andrew
10/29/2019, 5:21 PM
There can be nested routes or components that want to be history aware