From bfbd58ab3dfd416e0b7839bd449fc3d84fe0d904 Mon Sep 17 00:00:00 2001 From: LEE YOU BIN Date: Thu, 29 Aug 2024 07:02:24 +0900 Subject: [PATCH] =?UTF-8?q?[FIX/#206]=20state=20=EA=B4=80=EB=A6=AC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../terning/feature/mypage/profileedit/ProfileEditRoute.kt | 7 ++++++- .../feature/mypage/profileedit/ProfileEditViewModel.kt | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt index e48ecd21a..98c774e51 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditRoute.kt @@ -40,6 +40,11 @@ fun ProfileEditRoute( val profileEditState by viewModel.state.collectAsStateWithLifecycle() val lifecycleOwner = LocalLifecycleOwner.current + + LaunchedEffect(key1 = true) { + viewModel.updateName(initialName) + } + if (profileEditState.showBottomSheet) { SignUpBottomSheet( onDismiss = { viewModel.updateBottomSheet(false) }, @@ -69,7 +74,7 @@ fun ProfileEditRoute( viewModel.isInputValid(editName) }, onSaveClick = {/*TODO: 수정사항 저장 로직*/ }, - name = initialName, + name = profileEditState.name, onBackButtonClick = { viewModel.navigateUp() } ) } diff --git a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt index e4e955266..a8fa3c8ff 100644 --- a/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt +++ b/feature/src/main/java/com/terning/feature/mypage/profileedit/ProfileEditViewModel.kt @@ -84,7 +84,7 @@ class ProfileEditViewModel @Inject constructor() : ViewModel() { _state.value = _state.value.copy(showBottomSheet = isVisible) } - fun updateName(name: String){ + fun updateName(name: String) { _state.value = _state.value.copy(name = name) }