It might be my misunderstanding of this libary itself, but I seem to be running into an issue. I am currently using Android Navigation Component (v3.4.0) and I am using a bottom navigation bar, which are linked together.
The issue I am see is that when I navigate to another bottom navigation item, a new fragment is created and a new viewmodel. None of the previous instances are destroyed, or at least onDestroy is not being called. I can test the logic by consuming a flow, when I navigate from bottom nav item 1, to bottom nav item 2, then back to bottom nav item 1, and emitted items from the flow are received twice, as there are now 2 instances of bottom nav item 1s view model. I can also log the hashcodes of each instance and see there's a difference.
When I navigate up a level, and back, the higher level fragment and viewmodel have their onDestroy and onCleared called.
Am I misunderstanding how this library is supposed to work?