fix(admin): redirect to /admin/login after logout#322
Merged
Conversation
AdminSidebar's handleLogout only cleared client auth state via the store.
AdminLayout is a React Server Component so it does not re-render on
client state changes — the admin chrome stayed on screen with stale data
until a hard navigation. The DELETE /api/auth/session call was returning
200 but the user saw no visual change.
Fix: after `logout()` resolves, call `router.replace("/admin/login")` so
the route transitions client-side and the server layout re-runs with
no user, falling back to the login page.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
thxforall
added a commit
that referenced
this pull request
Apr 30, 2026
- router.replace()는 client soft-nav이라 AdminLayout(Server Component)이 재실행되지 않아 로그아웃 후에도 사이드바가 그대로 남음. - AuthProvider의 SIGNED_OUT 핸들러는 /api/auth/session DELETE를 비동기로 호출하지만 handleLogout에서 await할 수 없어, 세션 쿠키가 살아있는 상태로 /admin/login에 진입 → proxy.ts가 다시 /admin으로 바운스. - 쿠키 DELETE를 inline에서 await한 뒤 window.location.assign()으로 하드 네비게이션해 layout RSC가 admin chrome 없이 재렌더되도록 수정.
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.
Summary
Admin 사이드바 로그아웃 버튼 클릭 시
DELETE /api/auth/session은 200 반환하고 클라이언트 store state는 클리어되지만, 화면은 admin chrome 그대로 유지되고 로그인 페이지로 넘어가지 않는 UX 버그.Root cause
AdminSidebar.handleLogout은useAuthStore.logout()만 호출AdminLayout은 React Server Component → 클라이언트 auth state 변경에 재실행되지 않음 → admin chrome 잔존Fix
AdminSidebar.handleLogout에서logout()대기 후router.replace("/admin/login")호출. Replace 로 back-navigation 방지. Client 전환 시 layout 이 다시 돌아 login 페이지 fallback 이 적용됨.Test plan
bunx eslint lib/components/admin/AdminSidebar.tsx— pre-existing warning 외 이슈 없음bunx tsc --noEmit— 신규 에러 0스코프 외 (후속 후보)
SmartNav/profile-header-card/desktop-header의 logout 도 동일 패턴 점검 필요 (public 페이지는 서버 레이아웃 재실행 패턴이 달라 증상이 다를 수 있음). 본 PR 은 admin 영역만.