Skip to content

Commit

Permalink
Uodate getActiveChildContainers to always include the active containe…
Browse files Browse the repository at this point in the history
…r, regardless of the exclude list
  • Loading branch information
isaac-udy committed May 2, 2024
1 parent a735521 commit 454eca2
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,22 @@ internal object DefaultContainerExecutor : NavigationExecutor<Any, Any, Navigati
* be the active container for this container manager, and the next result will be the active container for that container manager,
* and so on. This method also takes an "exclude" parameter, which will exclude any containers with the given keys from the results,
* including their children.
*
* This will always include the active child of the navigation container that this was invoked on, regardless of whether the
* key of that container is in the exclude set or not.
*/
private fun NavigationContainerManager.getActiveChildContainers(
exclude: Set<String>,
): List<NavigationContainer> {
var activeContainer = activeContainer
val result = mutableListOf<NavigationContainer>()
activeContainer?.let { result.add(it) }

var activeContainer = activeContainer?.childContext?.containerManager?.activeContainer
while (activeContainer != null) {
result.add(activeContainer)
if (exclude.contains(activeContainer.key.name)) {
break
}
result.add(activeContainer)
activeContainer = activeContainer.childContext?.containerManager?.activeContainer
}
return result
Expand Down

0 comments on commit 454eca2

Please sign in to comment.