Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Walkthrough메시지 작성 완료 페이지에서 로그인 상태 확인 기능을 추가했습니다. useEffect 훅을 사용하여 페이지 마운트 시 hasFetchedAuth 상태를 확인한 후 checkAuth를 호출하는 방식으로 인증 상태를 자동 검증합니다. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10분
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
|
✨ Storybook: 🔗 https://690458540424857aa71aec97-yenrxdqcqv.chromatic.com/ |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/pages/letterPage/pages/letter-complete-page.tsx (2)
18-18: 의존성 배열 최적화를 고려해보세요.Zustand 스토어의 함수는 안정적인 참조를 유지하므로,
checkAuth를 의존성 배열에서 제외할 수 있습니다. 현재 구현은 안전하게 작동하지만, 불필요한 의존성입니다.🔎 제안하는 수정 사항
useEffect(() => { if (!hasFetchedAuth) { void checkAuth(); } - }, [hasFetchedAuth, checkAuth]); + }, [hasFetchedAuth]);또는 ESLint 규칙을 명시적으로 비활성화:
useEffect(() => { if (!hasFetchedAuth) { void checkAuth(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [hasFetchedAuth]);
14-18: 로딩 상태 표시를 고려해보세요.인증 확인 중에는
isCheckingAuth상태를 활용하여 로딩 인디케이터를 표시하는 것이 사용자 경험 측면에서 좋습니다. 현재는 인증 확인이 완료되기 전에 페이지가 렌더링되는데, 짧은 시간이지만 로딩 상태를 보여주면 더 나은 UX를 제공할 수 있습니다.🔎 제안하는 구현 방식
- const { isLoggedIn, hasFetchedAuth, checkAuth } = useAuthStore(); + const { isLoggedIn, isCheckingAuth, hasFetchedAuth, checkAuth } = useAuthStore(); useEffect(() => { if (!hasFetchedAuth) { void checkAuth(); } }, [hasFetchedAuth, checkAuth]); + if (isCheckingAuth) { + return ( + <div className="flex h-full w-full items-center justify-center"> + <p className="text-center font-primary text-lg text-red-200"> + 인증 확인 중... + </p> + </div> + ); + } const isJoinPage = location.pathname.startsWith("/join/");
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/pages/letterPage/pages/letter-complete-page.tsx(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/pages/letterPage/pages/letter-complete-page.tsx (1)
src/stores/useAuthStore.ts (1)
useAuthStore(20-75)
🔇 Additional comments (3)
src/pages/letterPage/pages/letter-complete-page.tsx (3)
2-2: LGTM!
useEffect임포트가 올바르게 추가되었습니다.
12-12: LGTM!인증 상태 확인을 위한
hasFetchedAuth와checkAuth추가가 적절합니다.
14-18: 로그인 상태 확인 로직이 올바르게 구현되었습니다.인증 상태가 아직 가져오지 않은 경우에만
checkAuth를 호출하는 로직이 정확합니다. PR 목표를 성공적으로 달성했습니다.
Summary
Tasks
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.