Skip to content

Commit

Permalink
Fix profile saving bug
Browse files Browse the repository at this point in the history
The problem was that we called the onSave callback (which starts a coroutine to save the profile) and didn't wait for it to finish before navigating to the map.
  • Loading branch information
octogradiste committed Jun 2, 2024
1 parent e1203d9 commit ddbf769
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ fun ProfileCreationScreen(
onFirstNameChange = viewModel::setFirstName,
onLastNameChange = viewModel::setLastName,
isEditing = isEditing,
isOnline = isOnline && state != CreateProfileState.SAVING,
isOnline = isOnline && state == CreateProfileState.EDIT,
picture = picture,
onPictureChange = viewModel::setPicture
)
Expand All @@ -176,7 +176,7 @@ fun ProfileCreationScreen(
)
}

if (state == CreateProfileState.SAVING) {
if (state != CreateProfileState.EDIT) {
Box(
modifier =
Modifier.fillMaxSize()
Expand Down Expand Up @@ -369,7 +369,6 @@ fun ProfileCreationUI(
} else {
try {
onSave(firstName, lastName)
navAction.navigateTo(Routes.MAP)
} catch (e: RepositoryStoreWhileNoInternetException) {
scope.launch {
snackbarHostState.showSnackbar(
Expand Down

0 comments on commit ddbf769

Please sign in to comment.