How can The Composable Architecture really become composable?

Thanks for pointing this out! I really hope this makes it into the main branch, as it solves one of my biggest annoyances with optional state in the Composable Architecture.

Something that this doesn't resolve is the case where you replace (rather than nil out) the state, for example:

state.child = Child()
//Any long-lived effects from the previous child state are still running, and may cause unexpected behaviour

I don't know if there is a good way to handle this in a similar manner to presents, or if it's just a matter of education, and knowing that your child reducer should guard against this behaviour.

As a concrete example, I have a child reducer that checks it's state when a value is loaded:

case .loaded(let value):
guard state.isLoading else {
return .none
}

state.isLoading = false
state.loadedValue = value

The above would ignore loaded actions if it wasn't expecting them. But it's unfortunate that I have to consider this at all.