Can I reuse one nested graph inside two parent gra...
# compose-destinations
s
Can I reuse one nested graph inside two parent graphs in compose destinations? Or I need to make the graph I want to reuse to be a separated graph and just have other graphs navigating to it?
r
Can I reuse one nested graph inside two parent graphs in compose destinations?
Same as with official library, no. If you would then navigate like
navigate(MyNestedGraphWithTwoParents)
how would it know which parent to put in the back stack?
gratitude thank you 1
👍 1
i
Technically, this is supported (just not recommended for most cases) in the official library. We even fixed an issue recently such that when you navigate to a destination that appears more than once, it will search inside the current graph before going up one layer, then two, etc.: https://issuetracker.google.com/issues/352006850
👍 2
r
Thanks @Ian Lake, I stand corrected, my bad @Steven Yang
👍 1
s
@Ian Lake Thanks! Though our project uses destinations so I can not use that feature. I'm personally curious about the appropriate use case. Let's say I have a video feature graph and a myPage feature graph. There are a couple of video detail pages needed to be displayed in both graphs. Is this a good place to create a reusable videoDetail nested graph?
r
Though our project uses destinations so I can not use that feature.
Honestly, now I'm not sure if you can or not 😅 I'd have to try it.
😂 1