-
Notifications
You must be signed in to change notification settings - Fork 89
Add FAQs page #182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add FAQs page #182
Conversation
This commit introduces a new `faqs.md` file to the documentation. The document provides answers to frequently asked questions about Navigation 3 (Nav3), covering topics such as its design philosophy, Compose Multiplatform readiness, state management, transitions, and implementation details like deep linking.
This change adds a "Frequently asked questions" section to the `README.md` file, which includes a link to a new FAQs page.
Summary of ChangesHello @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 introduces a dedicated Frequently Asked Questions (FAQs) page for Navigation 3 (Nav3). The new page serves as a central resource to address common queries and provide clarity on Nav3's design principles, usage patterns, and advanced features. Concurrently, the project's main Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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 adds a new FAQs page based on a YouTube video and links to it from the main README. The changes are well-structured and the new documentation is informative. I've found a couple of minor issues in the new FAQs file, including a typo and a missing newline at the end of the file. My suggestions address these points to improve the document's quality.
|
|
||
| ### How do I share a ViewModel between two screens? | ||
| You can achieve this in two main ways: | ||
| 1. **Custom Entry Decorator:** A custom decorator can control a `NavEntry`'s access to one or more `ViewModel`s. For example, a decorator could create a `ViewModel` that is shared between all entries on a back stack. Alternatively, an child entry could get access to a parent's view model by specifying the id of the parent in `metadata`. The custom decorator could then read that ID and provide the child entry with the parent's `ViewModel`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a small typo here. It should be 'a child' instead of 'an child'. I've also removed the trailing whitespace at the end of the line.
| 1. **Custom Entry Decorator:** A custom decorator can control a `NavEntry`'s access to one or more `ViewModel`s. For example, a decorator could create a `ViewModel` that is shared between all entries on a back stack. Alternatively, an child entry could get access to a parent's view model by specifying the id of the parent in `metadata`. The custom decorator could then read that ID and provide the child entry with the parent's `ViewModel`. | |
| 1. **Custom Entry Decorator:** A custom decorator can control a `NavEntry`'s access to one or more `ViewModel`s. For example, a decorator could create a `ViewModel` that is shared between all entries on a back stack. Alternatively, a child entry could get access to a parent's view model by specifying the id of the parent in `metadata`. The custom decorator could then read that ID and provide the child entry with the parent's `ViewModel`. |
| Deep link support is already available via **recipes** and a comprehensive guide. Because developers own the backstack in Nav3, deep linking is simply a matter of parsing the intent and building the correct backstack manually. | ||
|
|
||
| ### How can I combine different strategies (e.g., ListDetail, Dialog, BottomSheet)? | ||
| You can use the **`then` infix operator** to chain multiple strategies together. This creates a single strategy that evaluates the individual strategies in order. No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good practice to end files with a newline character. This can prevent issues with some tools and file concatenations.
| You can use the **`then` infix operator** to chain multiple strategies together. This creates a single strategy that evaluates the individual strategies in order. | |
| You can use the **`then` infix operator** to chain multiple strategies together. This creates a single strategy that evaluates the individual strategies in order. | |
| The "basic" nature of Nav3 is **intentional**. While Nav2 provided a pre-packaged "box" of navigation components (like `NavController` and `NavHost`) that were difficult to replace, Nav3 focuses on providing flexible **building blocks** designed to be as "Compose-like" as possible. | ||
|
|
||
| This approach allows developers to: | ||
| * Choose exactly which features (like decorators or `NavDisplay`) to include. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
decorators or scenes here
| The team decided to give control back to the developers. While most apps should use it, allowing manual placement ensures you can control **where** the state is held or substitute it with your own implementation if necessary. | ||
|
|
||
| ### Why is `SaveStateConfiguration` needed? | ||
| `SaveStateConfiguration` is used to store serializable values. A common use case is in multi-module apps where you need to inject a specific serializer for module-specific keys. In Nav3, the backstack primarily stores keys (identity), while actual state is stored in **decorators**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider this answer instead:
SavedStateConfiguration is mainly used to provide a SerializersModule for contextual or polymorphic serializers. A common case is a multi-module app with an unsealed abstract class inherited by the modules. In that case, the modules would need to register their derived classes with the SerializersModule and provide that SerializersModule to SavedStateConfiguration so that SavedState knows how to encode / decode the class.
Add FAQs page based on content from https://www.youtube.com/watch?v=JsugLEM6po0