From 6be1eab4d0729136b9b5a7b70e4b72d87e61fd52 Mon Sep 17 00:00:00 2001 From: Shashank Singhal Date: Wed, 28 Jul 2021 16:28:41 +0530 Subject: [PATCH] - Stop recomposing QuotesListScreen twice --- .../java/www/spikeysanju/jetquotes/navigation/NavGraph.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/java/www/spikeysanju/jetquotes/navigation/NavGraph.kt b/app/src/main/java/www/spikeysanju/jetquotes/navigation/NavGraph.kt index b33b046..049bfed 100644 --- a/app/src/main/java/www/spikeysanju/jetquotes/navigation/NavGraph.kt +++ b/app/src/main/java/www/spikeysanju/jetquotes/navigation/NavGraph.kt @@ -61,9 +61,7 @@ fun NavGraph(toggleTheme: () -> Unit) { NavHost(navController, startDestination = Screen.Home.route) { // Quotes List composable(Screen.Home.route) { - val viewModel: MainViewModel = viewModel( - factory = HiltViewModelFactory(LocalContext.current, it) - ) + val viewModel = hiltViewModel(it) QuotesListScreen(viewModel, toggleTheme, actions) }