-
Notifications
You must be signed in to change notification settings - Fork 49
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
scene invoked twice when used the variable navigation #338
Comments
Duplicate with #162 , but the fix in that PR is not working for current version, I still try to find a way to avoid unnecessary recomposition. |
Thank you for the info! |
Hi, any updates about this issue? The current workaround is invoking, for example a fetch request to update the UI data, after 3 times:
PreComposeApp {
navigator = rememberNavigator()
Theme {
NavHost(
navigator = navigator,
initialRoute = PROJECTS_SCREEN
) {
scene(
route = PROJECTS_SCREEN
) {
ProjectsScreen().ShowContent()
}
}
}
}
private val viewModel = ProjectsScreenViewModel(
snackbarHostState = snackbarHostState
)
companion object {
var int = 0
}
init {
if(int == 3) { // this currently seems to works as workaround (on Desktop this value is 4)
viewModel.setActiveContext(this::class.java)
viewModel.getProjects()
} else
int++
} |
No update yet, since compose multiplatform 1.7 is around the corner, I need to migrate to the compose 1.7 first, which might not be an easy work since |
Describe the bug
Hi, when I use the variable navigation the invocation of the current
scene
is invoked twice and this cause a double recomposition of that sceneTo Reproduce
Steps to reproduce the behavior:
App()
method with the snippet here belowHi
two timesExpected behavior
Single invocation of the
scene
, soHi
printed only onceMinimal reproducible example
The text was updated successfully, but these errors were encountered: