Skip to content
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

NestedGraph destinations not in parent NavGraphSpec.allDestinations #611

Closed
s0nance opened this issue Apr 15, 2024 · 5 comments
Closed

NestedGraph destinations not in parent NavGraphSpec.allDestinations #611

s0nance opened this issue Apr 15, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@s0nance
Copy link

s0nance commented Apr 15, 2024

Hello!

I encountered an issue where calling my current NavGraph .allDestinations extension is not returning the nested nav graphs destinations.

Here is my generated tree:

* * πŸ—ΊοΈ[MenuNavGraph]
* * βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™β†³πŸ—ΊοΈπŸ[Page1NavGraph]
* * βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™β†³πŸ“πŸ[Page1Screen]
* * βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™β†³πŸ—ΊοΈ[SettingsNavGraph]
* * βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™β†³πŸ“πŸ[SettingsScreen]
* * βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™β†³πŸ—ΊοΈ[FromSettingsLoginGraph]
* * βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™β†³πŸ“πŸ[LoginScreen]
* * βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™β†³πŸ—ΊοΈ[FromSettingsRegisterGraph]
* * βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™β†³πŸ“πŸ[RegisterScreen]
* * βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™β†³πŸ—ΊοΈ[Page2NavGraph]
* * βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™β†³πŸ“πŸ[Page2Route]
* * βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™β†³πŸ“[Page2-1Route]
* * βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™βˆ™β†³πŸ“[Page2-3Route]
*

I expect the extension to return, for FromSettingsLoginGraph, the given destinations:
[FromSettingsLoginLoginScreenDestination, FromSettingsRegisterRegisterScreenDestination], but it seems to only return FromSettingsLoginLoginScreenDestination.

Is this an expected behavior ?

I used a small function to check if my current destination is well a part of the nested navigation:

appCurrentDestinationState?.route?.let {
   topLevelDestination.graph.findDestination(it) // here topLevelDestination represents FromSettingsLoginGraph
} != null

and it returns true when I navigate to (so when appCurrentDestinationState route equals:) FromSettingsRegisterRegisterScreenDestination. So it seems it is indeed a part of the nested graphs!

By looking at your code, inside the SpecExtension.kt file, it seems you are recursively returning all destinations, even those from nestedNavGraphs, so I guess it is a bug?

I'm looking forward to hear your advice on this! Thank you

@raamcosta
Copy link
Owner

What Compose Destinations version are you using?

@raamcosta raamcosta added the feedback needed Extra attention is needed label Apr 27, 2024
@s0nance
Copy link
Author

s0nance commented Apr 29, 2024

Compose Destinations v2.0.0-beta01
Jetpack Compose version 1.6.5

@raamcosta
Copy link
Owner

Yes, you are right. Will be fixed on next versions. Thanks for reporting!

@raamcosta raamcosta added bug Something isn't working and removed feedback needed Extra attention is needed labels May 18, 2024
@raamcosta
Copy link
Owner

Included on beta07 building now. Thank you once again! πŸ™

@s0nance
Copy link
Author

s0nance commented May 18, 2024

No problem, it's been a pleasure!

Thanks for your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

2 participants