Skip to content

Commit

Permalink
also consider root from start stack in entryFor (#867)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielittner authored Aug 5, 2024
1 parent b46c262 commit 821c492
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class StackSnapshot internal constructor(
@InternalNavigationCodegenApi
public fun <T : BaseRoute> entryFor(destinationId: DestinationId<T>): StackEntry<T> {
return entries.lastOrNull { it.destinationId == destinationId } as StackEntry<T>?
?: startStackRootEntry.takeIf { it.destinationId == destinationId } as StackEntry<T>?
?: throw IllegalStateException("Route $destinationId not found on back stack")
}
}

0 comments on commit 821c492

Please sign in to comment.