Skip to content

Conversation

@Chiman2937
Copy link
Member

@Chiman2937 Chiman2937 commented Dec 16, 2025

📝 변경 사항

마이페이지에서 간헐적으로 프로필 정보가 업데이트 되지 않는 버그를 수정했습니다.

💡 원인

기존에는 updateUser(프로필 정보 수정), updateUserImage(프로필 이미지 수정) 함수가 병렬적으로 수행됩니다.
이는 api 요청 시간의 최소화를 위한 방식이었습니다.

const promises = [];

// 프로필 정보 업데이트 조건 체크
if (Object.keys(nextProfileInfo).length > 0) {
  promises.push(updateUser(nextProfileInfo));
}

// 프로필 이미지 업데이트 조건 체크
const imageFileObject = Object.values(profileImage)[0];
if (imageFileObject) {
  promises.push(updateUserImage({ file: imageFileObject }));
}

// API 병렬 실행
await Promise.all(promises);

이 때 비동기 처리의 순차적 실행이 보장되지 않기 때문에 문제가 일어납니다.

예를 들어, 아래와 같이 초기 데이터가 있다고 가정하겠습니다.

{
  profileImage: null,
  nickName: "김치영",
  profileMessage: null,
  mbti: null
}

아래 플로우와 같이 이미지 수정 요청의 응답이 더 늦게 온다면, 사진의 4번 항목이 profile 의 최종 데이터가 되기 때문에 profileMessage와 mbti 필드의 최종 값은 null이 되게 됩니다.

image

아마 반대의 경우에도 이미지가 null이 return 되는 경우가 있을 거라고 이론적으로는 예상되긴 하는데, 이 부분은 아직 검증하지 못했습니다.

그래서 각 api가 순차적으로 실행되게 만든다면 이 문제를 해결할 수 있습니다.

image

🔗 관련 이슈

Closes #


🧪 테스트 방법

  • 수동 테스트 검증(로컬 환경)
  • 유닛 테스트 검증
  • 통합 테스트 검증

📸 스크린샷 (선택)


📋 체크리스트

  • 관련 문서를 업데이트했습니다 (필요한 경우)
  • 테스트를 추가/수정했습니다 (필요한 경우)
  • Breaking change가 있다면 명시했습니다

💬 추가 코멘트


CodeRabbit Review는 자동으로 실행되지 않습니다.

Review를 실행하려면 comment에 아래와 같이 작성해주세요

@coderabbitai review

Summary by CodeRabbit

릴리스 노트

  • 버그 수정

    • 프로필 수정 모달에서 업데이트 안정성 개선
    • 개별 항목 업데이트 실패 시 더 명확한 오류 처리 추가
  • 개선사항

    • 프로필 정보 및 이미지 업데이트의 신뢰성 향상

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 16, 2025

Walkthrough

프로필 편집 모달의 제출 핸들러에서 병렬 뮤테이션(Promise.all)을 순차적 조건부 업데이트로 변경했습니다. 프로필 정보와 이미지 업데이트가 이제 순차적으로 실행되며, 성공 시에만 모달이 닫힙니다.

Changes

Cohort / File(s) Summary
프로필 편집 모달 제출 로직
src/components/pages/user/profile/profile-edit-modal/index.tsx
Promise.all 기반 병렬 뮤테이션에서 순차적 조건부 업데이트로 변경. updateUser(프로필 정보) → updateUserImage(이미지)의 순서로 실행되며, 성공 시에만 모달 종료. 에러 처리 구조 개선 및 per-item 에러 메시징 코멘트 추가.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • 단일 파일의 제출 핸들러 로직 변경이므로 검토 범위가 제한적입니다
  • 병렬 실행에서 순차 실행으로의 변경으로 인한 동작 차이 확인 필요
  • 에러 처리 및 모달 종료 시점 변경 로직 검증 권장

Possibly related PRs

Suggested labels

Ready For Review!

Suggested reviewers

  • wooktori

Poem

🐰 순서 맞춰 한 발씩, 차근차근
이미지와 정보가 악수를 나누네
에러도 잡고, 닫힘도 우아하게
뮤테이션의 춤, 이제 더 정확해진다! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed PR 제목이 변경사항의 주요 내용과 일치합니다. 순차적 업데이트로 변경하여 프로필 정보 업데이트 실패 문제를 해결한다는 의도가 명확하게 드러납니다.
Description check ✅ Passed PR 설명이 변경 사항 섹션에서 상세한 버그 원인 분석과 해결 방법을 제시하고 있으나, 테스트 방법과 관련 이슈 섹션이 불완전합니다.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chiyoung-fix/mypage-edit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot requested a review from wooktori December 16, 2025 12:30
@github-actions
Copy link

github-actions bot commented Dec 16, 2025

🎭 Playwright Report

E2E Test가 성공적으로 완료되었습니다.

Test 요약 내용을 확인해주세요.

Status Build Log Updated (UTC)
✅ Ready View Build 2025-12-16 12:32:52

📊 Test Summary

  • ✅ Passed: 9
  • ❌ Failed: 0
  • ⏱️ Duration: 80.3s

📜 Test Details

✅ Passed Tests (9)
  • profile.test.ts (9)
    • [chromium] 비로그인 상태에서 /mypage 접속 시 /login으로 redirect 되는 지 테스트
    • [chromium] 나의 프로필 페이지로 접속 시 /mypage로 /redirect 되는 지 테스트
    • [chromium] 존재하지 않는 프로필 페이지로 접속 시 404 redirect 되는 지 테스트
    • [firefox] 비로그인 상태에서 /mypage 접속 시 /login으로 redirect 되는 지 테스트
    • [firefox] 나의 프로필 페이지로 접속 시 /mypage로 /redirect 되는 지 테스트
    • [firefox] 존재하지 않는 프로필 페이지로 접속 시 404 redirect 되는 지 테스트
    • [webkit] 비로그인 상태에서 /mypage 접속 시 /login으로 redirect 되는 지 테스트
    • [webkit] 나의 프로필 페이지로 접속 시 /mypage로 /redirect 되는 지 테스트
    • [webkit] 존재하지 않는 프로필 페이지로 접속 시 404 redirect 되는 지 테스트

@github-actions
Copy link

github-actions bot commented Dec 16, 2025

🎨 Storybook Report

변경 사항이 없습니다

모든 Story가 이전 빌드와 동일합니다.

Status Storybook Build Log Updated (UTC)
✅ Unchanged View Storybook View Build 2025-12-16 12:31:23

@github-actions
Copy link

github-actions bot commented Dec 16, 2025

📊 Coverage Report

Status Build Log Updated (UTC)
✅ Ready View Build 2025-12-16 12:30:57

📈 #202main에 병합하면 coverage가 0.03% 증가합니다.

Coverage 요약

@@             Coverage Diff             @@
##             main     #202       +/-   ##
===========================================
+ Coverage   33.94%   33.97%    +0.03%     
===========================================
  Files         154      154         0     
  Lines        6528     6523        -5     
  Branches      248      248         0     
===========================================
  Hits         2216     2216         0     
- Misses       4312     4307        -5     

영향받은 파일

파일 Coverage 변화
/home/runner/work/WeGo_FrontEnd/WeGo_FrontEnd/src/components/pages/user/profile/profile-edit-modal/index.tsx 20.00% (+0.87%) ⬆️

@github-actions
Copy link

github-actions bot commented Dec 16, 2025

🚀 PR Preview Report

Build가 성공적으로 완료되었습니다.

Preview에서 변경사항을 확인하세요.

Status Preview Build Log Updated (UTC)
✅ Ready Visit Preview View Logs 2025-12-16 12:31:59

@Chiman2937
Copy link
Member Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 16, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c51ca9e and a0642b0.

📒 Files selected for processing (1)
  • src/components/pages/user/profile/profile-edit-modal/index.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: coverage
🔇 Additional comments (1)
src/components/pages/user/profile/profile-edit-modal/index.tsx (1)

61-69: 순차 실행으로 변경한 것은 적절하지만, 근본 원인 확인 필요

병렬 실행에서 순차 실행으로 변경하여 간헐적 버그를 수정한 것으로 보입니다. 이는 race condition이 원인이었다면 적절한 해결책입니다. 다만 다음 사항들을 고려해주세요:

  • 성능 트레이드오프: 순차 실행으로 인해 업데이트 시간이 증가합니다 (병렬 대비)
  • 부분 실패 처리: 프로필 정보 업데이트가 실패하면 이미지 업데이트가 시도되지 않습니다

다음을 확인해주세요:

  1. 이 변경이 실제로 간헐적 버그를 해결하는지 테스트
  2. 부분 실패 시나리오(예: 프로필 정보는 성공했으나 이미지 업로드 실패) 처리 전략 검토
#!/bin/bash
# Description: updateUser 및 updateUserImage hook 구현 확인하여 race condition 가능성 분석

# updateUser hook 구현 검색
echo "=== updateUser hook 구현 ==="
ast-grep --pattern $'export const useUpdateUser = () => {
  $$$
}'

# useUserImageUpdate hook 구현 검색  
echo "=== useUserImageUpdate hook 구현 ==="
ast-grep --pattern $'export const useUserImageUpdate = () => {
  $$$
}'

# 관련 mutation 로직 검색
echo "=== mutation 관련 코드 ==="
rg -n --type=ts --type=tsx -C5 'mutateAsync.*updateUser|updateUserImage'

Comment on lines +72 to +74
/*
todo: 이미지 변경과 정보 변경 중 하나라도 실패하면 각 항목에 대한 에러메시지 보여줘야함
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

사용자 피드백 누락으로 인한 UX 저하

현재 업데이트 실패 시 사용자에게 어떤 오류 메시지도 표시되지 않습니다. 이는 사용자 경험을 크게 저하시킵니다:

  • 업데이트가 실패했는지 성공했는지 알 수 없음
  • 모달이 열린 채로 유지되지만 이유를 알 수 없음
  • 어떤 항목(프로필 정보/이미지)이 실패했는지 구분 불가

최소한 다음을 구현하는 것을 권장합니다:

      } catch (error) {
-       /*
-       todo: 이미지 변경과 정보 변경 중 하나라도 실패하면 각 항목에 대한 에러메시지 보여줘야함
-       */
-       console.log('요청 실패', error);
+       // 사용자에게 오류 메시지 표시
+       const errorMessage = error instanceof Error ? error.message : '프로필 업데이트에 실패했습니다.';
+       // toast, alert, 또는 form error state를 통해 errorMessage 표시
+       console.error('프로필 업데이트 실패:', error);
      }

더 세밀한 에러 핸들링 (각 항목별 에러 메시지) 구현을 도와드릴까요?

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/components/pages/user/profile/profile-edit-modal/index.tsx around lines
72-74, the current TODO notes missing user feedback: on update failures no error
is shown, modal stays open with no reason, and failures between profile info vs
image aren’t distinguished. Implement granular error handling: catch errors from
the profile info update and the image upload separately, set field-specific
error state (e.g., imageError, infoError) and render inline messages next to the
affected inputs, and show a general toast/alert for overall failure/success.
Ensure the modal only closes on full success (or provide per-item success
indicators), and surface server/validation messages (fallback to a generic
message if none) so users know what went wrong and how to proceed.

@Chiman2937 Chiman2937 added the Ready For Review! 리뷰 받을 준비가 되었습니다. label Dec 16, 2025
@Chiman2937 Chiman2937 changed the title [Fix] mypage 수정 시 간헐적으로 프로필 정보가 업데이트 되지 않는 버그 수정 [Fix] 마이페이지 정보 수정 시 간헐적으로 프로필 정보가 업데이트 되지 않는 버그 수정 Dec 16, 2025
Copy link
Contributor

@wooktori wooktori left a comment

Choose a reason for hiding this comment

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

아까 예상하셨던게 맞았네요!!
설명 너무 깔끔합니다 완-벽✨✨

@Chiman2937 Chiman2937 merged commit 946b0dc into main Dec 16, 2025
11 checks passed
@Chiman2937 Chiman2937 deleted the chiyoung-fix/mypage-edit branch December 16, 2025 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready For Review! 리뷰 받을 준비가 되었습니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants