Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Walkthrough닉네임 검증 흐름에 조기 반환(빈 값 또는 기존 닉네임과 동일) 로직을 추가해 불필요한 검증 호출을 막고, MBTIBottomSheet에 선택적 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/pages/my/edit/editPage.tsx (1)
136-145:⚠️ Potential issue | 🟠 Major
updateProfileThunkdispatch 후await없이 즉시 페이지 이동합니다.
dispatch(updateProfileThunk(refinedForm))의 결과를 기다리지 않고 바로router.push('/my')를 호출하면,/my페이지에서 아직 업데이트되지 않은 이전 프로필 데이터가 표시될 수 있습니다.🛠️ 제안된 수정
const handleSubmit = async () => { const refinedForm = refineForm() if (nickNameMessage) { alert(nickNameMessage) } else { - dispatch(updateProfileThunk(refinedForm)) + await dispatch(updateProfileThunk(refinedForm)) router.push('/my') } }
🤖 Fix all issues with AI agents
In `@src/components/pages/my/edit/editPage.tsx`:
- Around line 70-100: The effect in useEffect that validates debouncedNickname
should include myPageData?.nickname in its dependency array and drop the
redundant debouncedNickname.length === 0 check; update the dependency list to
[debouncedNickname, myPageData?.nickname] so the compare debouncedNickname ===
myPageData?.nickname uses fresh data, and simplify the empty check to if
(!debouncedNickname) { setNickNameMessage(null); return; } while keeping the
existing validateNickname, checkNickname calls and setNickNameMessage branches
unchanged.
🧹 Nitpick comments (3)
src/components/pages/onboarding/mbtiBottomSheet.tsx (1)
14-14: 디버그용console.log를 제거해 주세요.프로덕션 코드에 디버그 로그가 남아 있습니다. 불필요한 콘솔 출력은 제거하는 것이 좋습니다.
🧹 제안된 수정
- console.log('[MBTIBottomSheet] ', mbti?.[0])src/components/pages/my/edit/editPage.tsx (2)
102-104: 디버그용console.log를 제거해 주세요.
mbtiBottomSheet.tsx와 마찬가지로 프로덕션 코드에 디버그 로그가 남아 있습니다.🧹 제안된 수정
useEffect(() => { - console.log('전역 상태 nickname', myPageData?.nickname) - console.log('로컬 상태 nickname', nickname) if (myPageData) {
271-271:mbti as MBTI타입 캐스팅 시null가능성에 주의하세요.
mbti상태는MBTI | null타입인데,mbti as MBTI로 캐스팅하면null일 때 타입 안전성이 깨집니다. 실제로는myPageData가드(Line 147)로 인해null일 가능성이 낮지만, 방어적으로 처리하는 것이 좋습니다.🛡️ 제안된 수정
- mbti={mbti as MBTI} + mbti={mbti ?? undefined}
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/pages/my/edit/editPage.tsx (1)
267-273:⚠️ Potential issue | 🟡 Minor
mbti as MBTI타입 단언 —mbti가null일 경우 안전하지 않을 수 있습니다
mbti상태가MBTI | null로 선언되어 있으므로(Line 62), 만약myPageData.mbti가 비어 있는 경우null이MBTI로 캐스팅되어MBTIBottomSheet내부에서 예기치 않은 동작이 발생할 수 있습니다.🛡️ 제안: null 가드 추가
- {mbtiBottomSheetOpen && ( + {mbtiBottomSheetOpen && mbti && ( <MBTIBottomSheet onClose={() => setMbtiBottomSheetOpen(false)} setMbti={setMbti} - mbti={mbti as MBTI} + mbti={mbti} /> )}
| const [selectedTF, setSelectedTF] = useState('') | ||
| const [selectedPJ, setSelectedPJ] = useState('') | ||
| const MBTIBottomSheet = ({ onClose, setMbti, mbti }: MBTIBottomSheetProps) => { | ||
| console.log('[MBTIBottomSheet] ', mbti?.[0]) |
| }, [debouncedNickname, myPageData]) | ||
|
|
||
| useEffect(() => { | ||
| console.log('전역 상태 nickname', myPageData?.nickname) |
| <MBTIBottomSheet | ||
| onClose={() => setMbtiBottomSheetOpen(false)} | ||
| setMbti={setMbti} | ||
| mbti={mbti as MBTI} |
| } else if (!res.isClean) { | ||
| setNickNameMessage('욕설을 포함한 닉네임은 사용할 수 없습니다.') | ||
| } else { | ||
| setNickNameMessage(null) |
| const [selectedEI, setSelectedEI] = useState(mbti?.[0] ?? '') | ||
| const [selectedNS, setSelectedNS] = useState(mbti?.[1] ?? '') | ||
| const [selectedTF, setSelectedTF] = useState(mbti?.[2] ?? '') | ||
| const [selectedPJ, setSelectedPJ] = useState(mbti?.[3] ?? '') |
There was a problem hiding this comment.
상태가 4개나 되네요
이러니 식은 어떤가요
const [mbtiState, setMbtiState] = useState({
EI: mbti?.[0] ?? '',
NS: mbti?.[1] ?? '',
TF: mbti?.[2] ?? '',
PJ: mbti?.[3] ?? '',
})
📝 요약
✅ 작업 내용
🧪 테스트 방법
📷 참고 자료 (스크린샷/링크/GIF 등)
🔬 관련 이슈
☝️ 참고 사항
Summary by CodeRabbit
릴리스 노트