-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Navigating is losing Screen state #318
Comments
Hi can you provide some sample code that reproduce this issue? |
Screen A ` @composable
}` |
Screen B `@OptIn(ExperimentalAdaptiveApi::class)
}` |
ToolBar code
|
Seems like you're fetching from LaunchedEffect(Unit)
{
viewModel.getGroupPlace(currentPage, pageCount)
//...
}
|
any solution her how to avoid api call when returning back to GroupsScreen? |
You can place your API call in ViewModel's initializer. |
you suggets me here `class GroupViewModel(private val mainUseCase: MainUseCase) : ViewModel() { val _uiState = MutableSharedFlow() fun getGroupPlace(currentPage: Int, pageCount: Int) {
}` |
Describe the bug
When we navigate from Screen A to Screen B and coming back to Screen A which leads to recreate screen A . means screen start recreates and re hits api call and fetches data
Expected behavior
Screen A state should be retained
The text was updated successfully, but these errors were encountered: