BottonNavigation fragment viewmodel not cleared on fragment destroy

Viewed 27

I use BottonNavigation to switch between fragments. The fragments have ViewModels annotated with @HiltViewModel and initilized by fragments as by viewModels().

Why do the ViewModels not get cleared/destroyed when the fragments are destroyed (on havigation between fragments)?

0 Answers
Related