Fix incorrect back navigation to ForYou instead of Topic screen (#1866)#2072
Fix incorrect back navigation to ForYou instead of Topic screen (#1866)#2072Amir-yazdanmanesh wants to merge 1 commit intoandroid:mainfrom
Conversation
Summary of ChangesHello @Amir-yazdanmanesh, 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 addresses a critical navigation bug where the application would lose its sub-stack state when navigating back after switching between tabs. The changes ensure that the back button correctly restores the user to their previous sub-page within a tab, rather than resetting to the tab's root. This significantly improves the user experience by maintaining expected navigation behavior across the application's tabbed interface. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
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
|
dd10f8c to
a61e4ee
Compare
There was a problem hiding this comment.
Code Review
The pull request successfully addresses the issue where back navigation from a sub-stack would incorrectly return to the app root instead of preserving the previous tab's state. The solution of isolating entries per tab in toEntries() and adding a BackHandler for cross-tab navigation is a solid architectural improvement that also resolves rendering issues with ListDetailSceneStrategy. The added unit and instrumented tests provide good coverage for the fix.
…oid#1866) When navigating ForYou → Topic → switch tab → back, the user landed on the ForYou screen instead of the Topic screen. The root cause was that toEntries() flattened all tab sub-stacks into a single entries list, causing ListDetailSceneStrategy to mis-render after cross-tab back. - Change toEntries() to only return entries from the current tab's sub-stack while still decorating all stacks for state preservation - Add BackHandler for cross-tab back navigation since NavDisplay now only sees within-tab entries - Add unit test for the sub-stack preservation scenario - Un-ignore navigationBar_multipleBackStackInterests test - Add back-button variant instrumented test
a61e4ee to
88c9bbd
Compare
instead of the tab root (ForYou)
Root Cause
toEntries() in NavigationState.kt flattened all tab sub-stacks into a single entries list. When pressing back from another tab, entries transitioned from [ForYouEntry,
TopicEntry, BookmarksEntry] to [ForYouEntry, TopicEntry], but ListDetailSceneStrategy failed to re-render the detail pane correctly because ForYouEntry lacks pane
metadata while TopicEntry has detailPane() metadata.
Test plan
Fixes #1866