refactor(auth): 헤더 인증 로직을 클라이언트 유저 상태로 전환#376
Merged
Merged
Conversation
elecharu
approved these changes
Jan 7, 2026
peachPetal
approved these changes
Jan 7, 2026
sehyun0518
approved these changes
Jan 7, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the header authentication logic from a server-side cookie-based approach to a client-side React Query state management pattern. The change improves consistency by centralizing user state management through React Query hooks.
- Introduced
useUserBasichook to fetch and cache user basic information on the client side - Created
HeaderAuthSlotcomponent to handle conditional rendering based on authentication state - Converted
HeaderActionsfrom an async server component to a synchronous client component that receives avatar data via props
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/features/user/api/use-user-basic.ts | Adds new React Query hook for fetching user basic information with error handling |
| src/widgets/header/ui/header-auth-slot.tsx | Adds new component that conditionally renders login button or HeaderActions based on user state |
| src/widgets/header/header.tsx | Removes server-side cookie checking and simplifies to use HeaderAuthSlot |
| src/widgets/header/ui/header-actions.tsx | Converts from async server component to sync client component receiving avatar props |
| src/widgets/header/ui/header-user-menu.tsx | Adds query cache cleanup on logout using queryClient.setQueryData |
| src/entities/user/index.ts | Exports getUserBasic function for use in the new hook |
| src/entities/user/api/user-api.server.ts | Removes React cache wrapper from getUserProfileServer function |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- 헤더의 인증/프로필 로직을 React Query 기반 클라이언트 상태로 이동 - 사용자 기본 정보를 조회하는 useUserBasic 훅 추가 - 로그인 상태 분기를 담당하는 HeaderAuthSlot 컴포넌트 추가 - HeaderActions가 서버에서 프로필을 조회하지 않고 avatar props를 받도록 수정 - 로그아웃 시 사용자 관련 query cache를 정리하도록 처리
- 유저 관련 queryKey를 userKeys로 중앙화 - HeaderSearch를 Suspense로 감싸도록 헤더 구성 변경 - Header 컴포넌트에서 불필요한 async 제거 - 로그아웃 시 유저 기본 쿼리를 null로 설정하는 방식 대신 유저 관련 query 전체 제거
c52edd0 to
a03ba4e
Compare
elecharu
approved these changes
Jan 7, 2026
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.
📖 개요
헤더 인증 로직을 클라이언트 유저 상태로 전환
📌 관련 이슈
N/A
🛠️ 상세 작업 내용
✅ PR 체크리스트
pnpm build로 실행 테스트