Skip to content

Conversation

@dturner
Copy link
Collaborator

@dturner dturner commented Nov 19, 2025

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @dturner, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request updates the Navigation 3 migration guide by converting it to a more standardized markdown format, enhancing its utility for AI agents, and providing comprehensive code examples for implementing Navigation 3's state management. The changes aim to clarify the migration process from Navigation 2 to Navigation 3, particularly concerning the replacement of NavController with Navigator and NavigationState, and the use of NavDisplay.

Highlights

  • Markdown Formatting: Removed explicit anchor IDs from section headings (e.g., {:#use-ai-agent}) for cleaner markdown syntax.
  • AI Agent Integration: Added a note indicating that AI agent usage with the guide is experimental, along with a link to file issues. An 'AI Agent' instruction was also added to prompt assumption checks.
  • Navigation State Management: Introduced detailed Kotlin code snippets for NavigationState.kt and Navigator.kt, providing concrete examples for managing navigation state in Navigation 3.
  • Component Mapping: Updated tables and textual descriptions to clearly map NavController methods and fields to their Navigator and NavigationState equivalents.
  • NavHost Replacement: Refined instructions for replacing NavHost with NavDisplay, including guidance on using navigationState.toEntries(entryProvider).
  • Documentation Clarity: Made several minor textual adjustments throughout the guide for improved clarity and conciseness, and standardized external links by removing {:.external}.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@dturner dturner merged commit 7526367 into main Nov 19, 2025
2 checks passed
@dturner dturner deleted the dt/migration branch November 19, 2025 18:44
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the migration guide from Navigation 2 to Navigation 3. The changes include adding detailed code snippets for NavigationState and Navigator, clarifying several steps, fixing typos, and improving the markdown formatting by using semantic table headers and removing processor-specific syntax. The guide is now more comprehensive and easier to follow. I've suggested a couple of improvements to the new code snippets to fix a bug and make the code more idiomatic.

Comment on lines +229 to +235
val stacksInUse: List<NavKey>
get(){
val stacksInUse = mutableListOf(startRoute)
if (topLevelRoute != startRoute) stacksInUse += topLevelRoute
return stacksInUse
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The implementation of the stacksInUse computed property can be simplified to be more concise and idiomatic. Using an if/else expression is cleaner than creating and modifying a mutable list.

Suggested change
val stacksInUse: List<NavKey>
get(){
val stacksInUse = mutableListOf(startRoute)
if (topLevelRoute != startRoute) stacksInUse += topLevelRoute
return stacksInUse
}
}
val stacksInUse: List<NavKey>
get() = if (topLevelRoute == startRoute) {
listOf(startRoute)
} else {
listOf(startRoute, topLevelRoute)
}

Comment on lines +295 to +296
val currentStack = state.backStacks[state.topLevelRoute] ?:
error("Stack for $state.topLevelRoute not found")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The string template in the error message is incorrect. It should use curly braces ${...} to correctly interpolate the topLevelRoute property of the state object. Without them, it will call toString() on the state object and append the literal string .topLevelRoute, which can be misleading when debugging.

Suggested change
val currentStack = state.backStacks[state.topLevelRoute] ?:
error("Stack for $state.topLevelRoute not found")
val currentStack = state.backStacks[state.topLevelRoute] ?:
error("Stack for ${state.topLevelRoute} not found")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant