Skip to content
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

[ComposeApp] Fix navigation issues #300

Merged
merged 2 commits into from
Nov 3, 2021
Merged

Conversation

PatilShreyas
Copy link
Owner

@PatilShreyas PatilShreyas commented Nov 1, 2021

Summary

Fix internal app navigation issues in Jetpack Compose app module

Description for the changelog

Checklist

  • Build and linting is passing.
  • This change is not breaking existing flow of a system.
  • I have written test case for this change.
  • This change is tested from all aspects.
  • Implemented any new third-party library (Which not existed before this change).

Comment on lines +184 to +191
LaunchedEffect(viewState?.isSuccess) {
if (viewState?.isSuccess == true) {
navController.navigate(Screen.Notes.route) {
launchSingleTop = true
popUpTo(NOTY_NAV_HOST_ROUTE)
}
}
}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling navigation methods directly from a @Composable function is not good and should be strictly avoided. It should be part of a callback. Using LaunchedEffect helps in achieving the same and finally, it fixes the navigation issues 😎

@PatilShreyas PatilShreyas added bug Something isn't working improvement labels Nov 1, 2021
@PatilShreyas PatilShreyas merged commit 6c2241b into v1.3.1-dev Nov 3, 2021
@PatilShreyas PatilShreyas deleted the fix/navigation-issues branch November 30, 2021 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working improvement
Projects
None yet
1 participant