feat: 로그인 후 리다이렉트 대상을 대시보드로 변경 - #79
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary by CodeRabbit릴리스 노트
Walkthrough인증 성공 후 기본 리다이렉트 경로를 Changes기본 리다이렉트 경로 변경 (/schedule/create → /dashboard)
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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/app/(auth)/login/page.tsx (1)
50-57: 🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift리다이렉트 로직 중복 — 공용 유틸리티 함수 필수.
login/page.tsx와signup/page.tsx에서 동일한 쿼리 파라미터 검사 로직(redirect/next추출 + 상대경로/외부URL 검증)이 3회 반복됨. 리다이렉트 정책 변경 시(예: 허용 경로 화이트리스트) 여러 곳 동시 수정 필요 → 누락 위험.
src/app/(auth)/login/page.tsx#L50-L57:handleSubmit내 redirectUrl 결정 로직을 공용 함수로 추출src/app/(auth)/login/page.tsx#L70-L79:handleOAuthLogin내 next 결정 로직을 동일 함수로 대체src/app/(auth)/signup/page.tsx#L334-L343:SocialButton.handleOAuthLogin내 next 결정 로직을 동일 함수로 대체🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/app/`(auth)/login/page.tsx around lines 50 - 57, The redirect URL validation logic that extracts and validates query parameters for redirect/next values is duplicated across three locations: in the handleSubmit method (lines 50-57 of src/app/(auth)/login/page.tsx), in the handleOAuthLogin method (lines 70-79 of src/app/(auth)/login/page.tsx), and in the SocialButton.handleOAuthLogin method (lines 334-343 of src/app/(auth)/signup/page.tsx). Create a single shared utility function that accepts optional current parameters and returns the validated redirect URL, encapsulating the logic for extracting the redirect/next query parameter and validating that it's either a relative path or not an external URL (contains no "://"). Then replace the duplicated logic at all three locations with calls to this utility function.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@e2e/host-flow.spec.ts`:
- Around line 81-82: The code at lines 81-82 is safe, but add a defensive load
state verification before the waitFor call on line 83 to follow Playwright best
practices. After the page.goto call at line 82 and before the waitFor for page
elements, insert a page.waitForLoadState call (such as 'networkidle' or
'domcontentloaded') to ensure the page has fully loaded and the network is idle
before attempting to wait for and interact with page elements. This improves E2E
test stability and reliability.
---
Outside diff comments:
In `@src/app/`(auth)/login/page.tsx:
- Around line 50-57: The redirect URL validation logic that extracts and
validates query parameters for redirect/next values is duplicated across three
locations: in the handleSubmit method (lines 50-57 of
src/app/(auth)/login/page.tsx), in the handleOAuthLogin method (lines 70-79 of
src/app/(auth)/login/page.tsx), and in the SocialButton.handleOAuthLogin method
(lines 334-343 of src/app/(auth)/signup/page.tsx). Create a single shared
utility function that accepts optional current parameters and returns the
validated redirect URL, encapsulating the logic for extracting the redirect/next
query parameter and validating that it's either a relative path or not an
external URL (contains no "://"). Then replace the duplicated logic at all three
locations with calls to this utility function.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 91942fa9-a947-428e-b959-b603e27bf1fd
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json,!**/*.json,!package-lock.json
📒 Files selected for processing (6)
e2e/calendar-integration.spec.tse2e/host-flow.spec.tssrc/app/(auth)/login/page.tsxsrc/app/(auth)/signup/page.tsxsrc/app/api/auth/naver/callback/route.tssrc/app/api/naver/callback/route.ts
| await page.waitForURL("**/dashboard", { timeout: 60000 }); | ||
| await page.goto("/schedule/create"); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# /dashboard 페이지 구현 확인: 자동 리다이렉트 로직 유무, 비동기 데이터 페칭 여부
ast-grep --pattern $'export default function $_($$) {
$$$
redirect($$$)
$$$
}' src/app/dashboard
# useEffect 내 네비게이션 로직 검색
rg -nP --type=tsx -C3 'useRouter|redirect|window\.location' src/app/dashboardRepository: Siul49/moim
Length of output: 83
🏁 Script executed:
# dashboard 페이지 위치 확인
fd -e ts -e tsx "dashboard" src/app/Repository: Siul49/moim
Length of output: 37
🏁 Script executed:
# dashboard 페이지 리다이렉트/네비게이션 로직 검색 (타입 지정 수정)
rg -nP --type ts,tsx -C3 'useRouter|redirect|window\.location' src/app/Repository: Siul49/moim
Length of output: 86
🏁 Script executed:
# host-flow.spec.ts 전체 L75-90 구간 확인
sed -n '75,90p' e2e/host-flow.spec.tsRepository: Siul49/moim
Length of output: 612
🏁 Script executed:
# dashboard 페이지 구현 전체 확인 (ast-grep 대신 rg로 export default 검색)
rg -A 20 'export default function|export const.*dashboard' src/app/dashboard --type ts,tsxRepository: Siul49/moim
Length of output: 86
🏁 Script executed:
# dashboard 페이지 파일 확인 (경로 재검색)
find src/app -type d -name "dashboard"Repository: Siul49/moim
Length of output: 73
🏁 Script executed:
# dashboard 관련 모든 파일 검색
find src -name "*dashboard*"Repository: Siul49/moim
Length of output: 73
🏁 Script executed:
# (auth) 이후 로그인 후 이동 페이지 확인 - app 구조 조회
find src/app -type f \( -name "page.tsx" -o -name "layout.tsx" \) | head -20Repository: Siul49/moim
Length of output: 591
🏁 Script executed:
# host-flow.spec.ts 전체 코드 읽기 (파일 크기 확인 후)
wc -l e2e/host-flow.spec.tsRepository: Siul49/moim
Length of output: 81
🏁 Script executed:
# dashboard/page.tsx 구현 확인
cat src/app/dashboard/page.tsxRepository: Siul49/moim
Length of output: 734
🏁 Script executed:
# host-flow.spec.ts 전체 코드 읽기 (127줄)
cat e2e/host-flow.spec.tsRepository: Siul49/moim
Length of output: 4420
/dashboard 대기 후 바로 네비게이션 — 현 코드는 안전하나 방어적 로드 확인 추가 권장.
L81-82의 패턴 자체는 안전합니다. dashboard/page.tsx는 리다이렉트 로직 없는 서버 컴포넌트이고, waitForURL 완료는 리다이렉트 및 페이지 로드 시작을 의미하므로 L82의 goto와 충돌하지 않습니다. 다만 L83의 waitFor 앞에 명시적 로드 상태 확인을 추가하면 더욱 견고합니다.
Why: E2E 테스트 안정성 및 Playwright 모범 사례 (네트워크 유휴 상태 보장)
How: 페이지 요소 대기 전에 로드 완료 확인
await page.waitForURL("**/dashboard", { timeout: 60000 });
await page.goto("/schedule/create");
+
const titleInput = page.getByLabel("모임 제목");
-await titleInput.waitFor({ state: "visible", timeout: 15000 });
+await page.waitForLoadState("networkidle");
+await titleInput.waitFor({ state: "visible", timeout: 15000 });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@e2e/host-flow.spec.ts` around lines 81 - 82, The code at lines 81-82 is safe,
but add a defensive load state verification before the waitFor call on line 83
to follow Playwright best practices. After the page.goto call at line 82 and
before the waitFor for page elements, insert a page.waitForLoadState call (such
as 'networkidle' or 'domcontentloaded') to ensure the page has fully loaded and
the network is idle before attempting to wait for and interact with page
elements. This improves E2E test stability and reliability.
🚀 작업 내용 (What)
로그인햇을 때 메인화면 보이게
📣 핵심 변경 이유 (Why)
냅다 모임만들기 뜨니까 당황스러부요
📸 스크린샷 (Visuals, 선택)
🔗 관련 이슈 (Issue)
Close #