Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public fun NavigationScene(
* @param scene Scene builder composable function that defines how navigation entries are rendered
*/
@Composable
@Suppress("CognitiveComplexMethod")
@Suppress("CognitiveComplexMethod", "MaximumLineLength", "MaxLineLength")
public fun NavigationScene(
navController: NavController,
destinationResolver: (name: String) -> NavDestination<*>?,
Expand Down Expand Up @@ -278,8 +278,12 @@ public fun NavigationScene(
if (!entry.isResolved) entry.resolveDestination(destinationResolver)
NavEntryContent(entry)
DisposableEffect(entry) {
if (visibleEntries.contains(entry))
error("The same entry (${entry.destination.name}) should not be displayed twice")
if (destinationResolver(entry.destination.name) == null) error(
"NavController: ${navController.key}, the destination (${entry.destination.name}) is not registered in Navigation"
)
if (visibleEntries.contains(entry)) error(
"NavController: ${navController.key}, the same entry (${entry.destination.name}) should not be displayed twice"
)
visibleEntries.add(entry)
onDispose {
visibleEntries.remove(entry)
Expand Down