[FEAT] 로그인 가드에서 사용자 시간대(IANA) 감지 후 서버 동기화 - #201
Conversation
- accessToken 확보 시 Intl.DateTimeFormat으로 IANA 시간대를 감지해 useUpdateTimezone PATCH를 호출하도록 추가했습니다 - syncedTokenRef로 같은 토큰에 대해 중복 PATCH가 발생하지 않도록 했습니다
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 12 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Walkthrough
Changes인증 시간대 동기화
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant AuthGuardProvider
participant Intl.DateTimeFormat
participant useUpdateTimezone
AuthGuardProvider->>Intl.DateTimeFormat: resolvedOptions().timeZone 조회
Intl.DateTimeFormat-->>AuthGuardProvider: IANA timezone 반환
AuthGuardProvider->>useUpdateTimezone: updateTimezone({ zoneId }) 호출
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
Timo Performance ReportBundle Size — timo-web
Lighthouse — timo-web
Image Optimization — timo-web
측정 커밋: |
- 타임존 동기화 로직을 로그인 가드(AuthGuardProvider)에서 OAuth 콜백(OauthCallbackContainer)으로 옮겼습니다 - accessToken이 localStorage에 남아있는 상태로 새로고침될 때마다 컴포넌트가 리마운트되어 동기화 API가 매번 재호출되던 문제를 해결했습니다 - 이제 실제 로그인이 성공하는 시점에만 서버로 타임존이 동기화됩니다
jjangminii
left a comment
There was a problem hiding this comment.
타임존을 언제 보내야하나 고민했었는데 확실히 아직은 로그인시에만 보내는게 맞다고 생각이 드네요..
고생하셨습니다~ 여행가서 테스트해보고싶어요
ISSUE 🔗
close #199
What is this PR? 🔍
로그인 시 브라우저의 IANA 시간대를 감지해 서버에 동기화하는 로직을 추가했습니다. 최초 구현은 로그인 가드(
AuthGuardProvider)에서accessToken존재 여부를 기준으로 동기화했는데, 새로고침·재발급마다 불필요하게 재호출되는 문제가 있어 실제 로그인이 일어나는 OAuth 콜백 시점으로 옮겼습니다.배경
AuthGuardProvider에서accessToken변화를 기준으로 삼았습니다.accessToken이localStorage에 저장돼 있어 새로고침마다 컴포넌트가 리마운트되고, dedup에 쓰던useRef가 매번 초기화되어 같은 토큰 값이어도 새로고침할 때마다 PATCH가 재전송됐습니다. 401 재발급(reissue) 때도 토큰 문자열이 바뀌어 다시 트리거됐습니다.시간대 동기화 위치 이동 (AuthGuardProvider → OauthCallbackContainer)
변경 요약:
useUpdateTimezonemutation 호출을AuthGuardProvider에서 제거하고,OauthCallbackContainer의 토큰 교환 성공(onSuccess) 콜백 안으로 옮겼습니다.이유:
AuthGuardProvider는 인증된 모든 화면(온보딩,(main)레이아웃 하위 전체)을 감싸는 가드라서 새로고침마다 다시 마운트됩니다. 그 안에서 dedup에 쓰던useRef는 컴포넌트 생명주기에 묶여 있어 페이지 새로고침 시 리셋되는 것을 막을 수 없었습니다. 반면OauthCallbackContainer는 실제 OAuth 로그인이 성공했을 때만 렌더링되는 화면이라 "로그인 시점에 한 번"이라는 의도를 컴포넌트 위치만으로 보장할 수 있습니다.구현 방식:
OauthCallbackContainer의 토큰 교환onSuccess에서setAccessToken직후 시간대를 동기화합니다.AuthGuardProvider는 다시 인증 가드(비로그인 시/login리다이렉트) 역할만 담당하도록 되돌렸습니다.경계 · 제약: 401 인터셉터의 accessToken 재발급(
axios.ts)에서는 더 이상 시간대를 재동기화하지 않습니다 — 재발급은 로그인이 아니라 세션 유지이므로 이번 범위에서는 제외했습니다. 로그인 상태를 유지한 채 기기 시간대를 변경한 사용자는 재로그인 전까지 서버에 반영되지 않는데, 이 트레이드오프는 의도된 단순화이며 필요하면 후속 작업으로 남깁니다.To Reviewers
이전 리뷰에서 새로고침·재발급마다 값이 같아도 재호출되는 점을 지적해주셔서, 실제 로그인 시점(OAuth 콜백)에만 호출하도록 변경했습니다. 다만 로그인 상태를 유지한 채 시간대를 바꾼 사용자는 재로그인하기 전까지는 서버에 반영되지 않는데, 이 트레이드오프가 괜찮은지 확인 부탁드립니다.
Screenshot 📷
Test Checklist ✔
pnpm check-types통과pnpm lint통과