Repository navigation
Conversation
snughnu
approved these changes
Nov 18, 2026
Comment on lines
+140
to
+169
| private func save( | ||
| _ newProfile: MyPageProfile, | ||
| item: ProfileSaveFailure.Item, | ||
| retry: @escaping () -> Void, | ||
| update: @escaping () async throws -> User | ||
| ) { | ||
| guard let previous = profile else { return } | ||
|
|
||
| latestProfileSaveID += 1 | ||
| let saveID = latestProfileSaveID | ||
| profile = newProfile | ||
|
|
||
| Task { @MainActor in | ||
| do { | ||
| let user = try await update() | ||
| guard saveID == latestProfileSaveID else { return } | ||
| profile = MyPageProfile(user: user) | ||
| } catch { | ||
| guard saveID == latestProfileSaveID else { return } | ||
| profile = previous | ||
| let isNetworkError: Bool | ||
| if case AppError.network = error { | ||
| isNetworkError = true | ||
| } else { | ||
| isNetworkError = false | ||
| } | ||
| profileSaveFailure = ProfileSaveFailure(item: item, isNetworkError: isNetworkError, retry: retry) | ||
| } | ||
| } | ||
| } |
Collaborator
There was a problem hiding this comment.
저장이 연달아 일어날 때를 생각해 보다가 다음 상황이 문제되는 경우도 있는지 확인 부탁드려요!
위치 공유 설정 화면은 항목을 누를 때마다 onOptionSelected가 호출되니까,
빠르게 A → B를 누르면 저장 요청이 두 번 겹칠 수 있을 것 같아요.
- 처음 값이 X일 때 A를 누르면, 요청 1의 previous는 X
- 이어서 B를 누르면, 요청 2의 previous는 A(아직 저장되지 않은 값)
- 요청 1이 실패하면, saveID가 최신이 아니어서 되돌리지도 않고 알럿도 없이 return
- 요청 2도 실패하면, 화면은 previous인 A로 돌아가지만 서버에는 X가 남아 있음
맞다면 화면에 서버와 다른 값이 남고, 요청 1의 실패는 사용자에게 알려지지 않을 것 같습니다.
그래서 실패했을 때 previous로 되돌리는 대신, fetchMyUserUseCase로 서버 값을 다시 읽어서 맞추는 건 어떨까요? 그러면 요청이 몇 개 겹쳐도 화면이 마지막엔 서버 값과 같아질 것 같습니다!
다른 방법으로는, 앞선 저장이 끝날 때까지 다음 저장을 막거나 순서대로 처리하는 것도 있을 것 같습니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JIRA
📝 작업 내용
📌 요약
🔍 상세
[1] 유저 정보 수정 저장소
UserRepository.updateUser: 닉네임·프로필 이미지·위치 공유 범위·전체 알림 수정. nil인 항목은 변경하지 않고, 저장 후 다시 조회한 유저를 반환 (updateAppointment와 같은 방식)UserDTO: 위치 공유 범위 ↔ 문자열 변환을 정적 함수로 분리, 가입 시 기본값에도 같은 변환 사용[2] 내 유저 정보 유스케이스 (
Domain/UseCase/User폴더 신규)FetchMyUserUseCase: 로그인한 내 유저 정보 조회UpdateMyUserUseCase: 내 유저 정보 수정AuthRepository에서 받고, 로그인 상태가 아니면AppError.notAuthenticated[3] 마이페이지 연결
"성훈","shark") 삭제, 화면이 나타날 때마다 내 유저 정보 조회프로필 카드: 프로필 수정 화면에서 저장 시 닉네임·이미지 저장위치 공유 설정: 항목 선택 시 저장전체 알림 스위치: 토글 시 저장[4] 저장 실패 처리
ProfileSaveFailure: 실패한 항목, 네트워크 오류 여부, 같은 값으로 다시 저장하는 동작프로필이 바뀌지 않았어요/위치 공유 설정이 바뀌지 않았어요/알림 설정이 바뀌지 않았어요네트워크 연결을 확인한 뒤 다시 시도해 주세요., 그 외잠시 후 다시 시도해 주세요.취소,다시 시도💬 리뷰 노트
위치 공유 설정 화면에서 실패했을 때
설정 화면은 항목을 누르는 즉시 선택 표시를 바꾸고, 결과만 마이페이지로 넘깁니다. 그래서 저장에 실패해도 설정 화면에는 새 값이 남는 문제가 있었습니다.
설정 화면이 저장된 값을 구독하게 하는 방법도 있었지만, 설정 화면은 선택만 담당하도록 단순하게 두고 싶었습니다.
👉 결론: 실패하면 마이페이지로 돌아온 뒤 알럿 표시 (이미 다른 화면으로 이동했다면 화면은 그대로 둠)
추후 작업
users.appointmentsNotification에 연결하는 작업은 다음 PR에서 진행합니다."유저"로 만들어집니다. 가입 시 닉네임 입력 화면을 띄우는 작업으로 해결할 예정입니다.📸 영상 / 이미지
WORK78.success.MP4
WORK78.failed.MP4