I am trying to navigatie from profile screent to auth_graph but when i do it form app navigation it works but when i try to do it from buyer app navigation it shows
java.lang.IllegalStateException: Restore State failed: destination 1536633651 cannot be found from the current destination Destination(0xd9408a4f) route=Login_Screen
I am expecting that it should have the same behaviour in both graphs
@Composable
fun MasterNavigation (
navController: NavHostController,
currentUser:FirebaseUser?,
userType: UserType?,
sharedViewModel: SharedViewModel = hiltViewModel()
) {
val currentuser = Firebase.auth.currentUser
var startDestination = "Auth_Graph"
if(currentuser !=null){
// startDestination = "App_Navigation"
if(userType == UserType.CUSTOMER){
startDestination = "Buyer_App_Navigation"
}
else if(userType == UserType.PROVIDER){
startDestination = "App_Navigation"
}
else{
startDestination = "App_Navigation"
}
// startDestination = "test"
}
NavHost(navController = navController,startDestination = startDestination ){
composable("test"){
LoginScreen(navController = navController)
}
navigation(route= "Auth_Graph",startDestination = "Login_Screen"){
composable("Login_Screen"){
LoginScreen(navController)
}
composable("Register_Screen"){
RegisterScreen(navController)
}
}
navigation(route = "App_Navigation",startDestination = "Home_Screen" ){
composable("Home_Screen"){
// AddProductScreen()
HomeScreen(sharedViewModel = sharedViewModel,navController)
}
composable("Chat_Screen"){
ChatScreen()
}
composable("Market_Price_Screen"){
MarketPriceScreen()
}
composable("Add_Product_Screen"){
AddProductScreen()
}
composable("Profile_Screen"){
ProfileScreen(navController = navController)
}
navigation(route="Edit_Product",startDestination = "Edit_Product_Screen"){
composable("Edit_Product_Screen"){
EditProductScreen(navController,sharedViewModel)
}
}
}
navigation(route = "Buyer_App_Navigation",startDestination = "Buyer_Home_Screen"){
composable("Buyer_Home_Screen"){
BuyerHomeScreen(navController)
}
composable("Chat_Screen"){
ChatScreen()
}
composable("Market_Price_Screen"){
MarketPriceScreen()
}
composable("Profile_Screen"){
ProfileScreen(navController = navController)
}
navigation(route="Product_Detail",startDestination = "Product_Detail_Screen"){
composable("Product_Detail_Screen"){
ProductDetailScreen(navController,sharedViewModel)
}
}
}
}
}