Closed ChloeMayhewELT closed 1 year ago
Thanks @ChloeMayhewELT for such a thorough explanation and reproduction! The issue as I understand it is this:
There are two workarounds I see:
EffectTask.routeWithDelaysIfUnsupported
to break the state updates into smaller state updates that NavigationView can handle, separated by a necessary delay. Note that this will necessarily mean your views will be animated in one at a time. Here's how that would look in your example .ifLet(\.content, action: /Action.content) {
Minimizable<MultiScreenCoordinator>(child: MultiScreenCoordinator.init)
Reduce { state, action in
switch action {
case .binding(.set(\.$isMinimized, false)):
let routesToRestore = state.child.routes
return EffectTask<MultiScreenCoordinator.Action>.routeWithDelaysIfUnsupported([]) {
$0 = routesToRestore
}
.map(Minimizable.Action.child)
default:
return .none
}
}
}
Thanks for taking a look at this so quickly, @johnpatrickmorgan. Much appreciated!
I had tried EffectTask.routeWithDelaysIfUnsupported
when initially investigating the issue, but was clearly using it in entirely the wrong place. Using it here does indeed resolve the issue. Thanks for the fix!
In our app we have a coordinator that can be minimized, so the user can return to it later. It works fine if only the root view and one pushed view exist. But anything more than that and when maximized an
.updateRoutes
action is received which removes all but the root view and the first pushed view.Obviously this is an unusual use-case. Could well be something strange that we've done. But it seems like the
.updateRoutes
action is coming from within the internals of TCACoordinators. Hoping someone can help with this.NOTE: Also, ideally when maximizing the process wouldn't be animated. But we can live with that if that's just a by product of the the coordinator works. The main problem is the screens disappearing.
Package versions ComposableArchitecture version 0.55.1 TCACoordinators version 0.4.3
Expected behavior When the custom minimization is applied, and then reversed to maximize the content, we would not expect any of the pushed views to be removed from the stack.
Actual behavior All but the root view and the first pushed view get removed.
Steps to reproduce Example project which displays the problem: https://github.com/ChloeMayhewELT/MinimizableCoordinatorBug