Scoping Hilt ViewModels to the Navigation Back Stack in Jetpack Compose

One of the first “wait, why is my ViewModel getting recreated?” moments in a Compose app happens when you mix Hilt, Navigation Compose, and…