Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
This actually has nothing to do with NavHostFragment, but is the behavior of NavController's setGraph().
When you call navController.setGraph(R.navigation.navigation_graph), it stores that ID and will restore that ID automatically.
If you were to instead use:
NavInflater navInflater = new NavInflater(this, navController.getNavigatorProvider());
navController.setGraph(navInflater.inflate(R.navigation.navigation_graph));
Then NavController would not restore the graph itself and the call to restoreState() you point out would only restore the back stack state, etc. but would wait for you to call setGraph again.
You're right that the inconsistency between the two setGraph methods is concerning. We'll take a look.
When you call navController.setGraph(R.navigation.navigation_graph), it stores that ID and will restore that ID automatically.
If you were to instead use:
NavInflater navInflater = new NavInflater(this, navController.getNavigatorProvider());
navController.setGraph(navInflater.inflate(R.navigation.navigation_graph));
Then NavController would not restore the graph itself and the call to restoreState() you point out would only restore the back stack state, etc. but would wait for you to call setGraph again.
You're right that the inconsistency between the two setGraph methods is concerning. We'll take a look.
lp...@google.com <lp...@google.com> #3
Turns out, we already had a tracking bug for this issue, will follow up on that other one.
Description
For the CLs to merge focusable node into clickable, and also to migrate selectable and toggleable to use a clickable node directly, this means that although there are notable improvements to first composition, the re-use case in the benchmarks is slower as we are doing more work on update.
Another thing to note here is that currently as implemented, just turning off auto invalidation on the main clickable node won't stop its delegates from being invalidated - _everything_ needs to have this turned off.
Because there are still notable improvements to first composition and there are lots of ongoing refactorings here that would make it more costly to disable auto invalidation and then keep that working through everything else we plan to refactor, we decided to still move forward with these changes with the knowledge that when we flatten the nodes / make further refactorings we should be able to disable auto invalidation again and undo these regressions. This bug is to track that, and also to make sure we fix this regression before next beta.