fix: 토너먼트·위시 흐름 전반의 뒤로가기 동작 정리 - #409
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Discord 스레드 연동용 메타데이터입니다. discord-pr-bot 워크플로가 자동 생성하며, 수정·삭제하면 PR 과 Discord 알림 연동이 끊깁니다. |
|
Warning Review limit reached
Next review available in: 28 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. 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: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthrough위시리스트와 토너먼트 흐름에 Changes위시리스트 및 토너먼트 내비게이션
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant AppProviders
participant useTrackAppHistoryDepth
participant WishOrTournamentFlow
participant NextRouter
AppProviders->>useTrackAppHistoryDepth: 앱 경로 변경 감시 시작
useTrackAppHistoryDepth->>useTrackAppHistoryDepth: history.state에 앱 히스토리 깊이 저장
WishOrTournamentFlow->>NextRouter: backWithFallback(fallback)
alt 앱 히스토리 깊이 > 0
NextRouter->>NextRouter: router.back()
else 앱 히스토리 깊이 = 0
NextRouter->>NextRouter: router.replace(fallback)
end
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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: 2
🤖 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
`@apps/web/src/app/tournament/`[id]/create/by-wish/_hooks/usePostTournamentItemsByWish.ts:
- Around line 20-22: 성공 처리의 router.back() 호출을 공용 useBackWithFallback 훅으로 교체하세요.
해당 훅에 ROUTES.TOURNAMENT_CREATE(tournamentId)를 fallback으로 전달해 히스토리가 있으면 기존 back
동작을 유지하고, 없으면 replace로 생성 화면으로 이동하도록 하며, 기존 sessionStorage scroll marker 기록은
유지하세요.
In `@apps/web/src/hooks/useBackWithFallback.ts`:
- Around line 6-17: Update useBackWithFallback to track whether the current
session contains an app-created history entry or marker, and call router.back()
only when that app-internal history is valid. Do not rely solely on
window.history.length; otherwise preserve the existing router.replace(fallback)
path for external deep links and sessions without a tracked app history.
🪄 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: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 56261a8b-785e-484a-9985-13c772cc4d25
📒 Files selected for processing (14)
apps/web/src/app/archive/wish/[id]/_hooks/useDeleteWish.tsapps/web/src/app/archive/wish/[id]/_hooks/usePatchWish.tsapps/web/src/app/archive/wish/[id]/_hooks/usePostWishRefresh.tsapps/web/src/app/tournament/[id]/_common/_hooks/useDeleteTournamentItem.tsapps/web/src/app/tournament/[id]/create/_components/TournamentCreateClient.tsxapps/web/src/app/tournament/[id]/create/_components/tournament-header/TournamentHeader.tsxapps/web/src/app/tournament/[id]/create/_hooks/usePostTournamentStart.tsapps/web/src/app/tournament/[id]/create/by-wish/_hooks/usePostTournamentItemsByWish.tsapps/web/src/app/tournament/[id]/item/[itemId]/_hooks/usePatchTournamentItem.tsapps/web/src/app/tournament/[id]/loading/page.tsxapps/web/src/app/tournament/[id]/match/_hooks/useTournament.tsapps/web/src/app/tournament/[id]/result/group/_components/GroupResultClient.tsxapps/web/src/app/tournament/join/[id]/_components/JoinPreviewClient.tsxapps/web/src/hooks/useBackWithFallback.ts
ba2b1f6 to
7f98b3b
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/web/src/hooks/useBackWithFallback.ts (1)
23-42: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win동일 pathname의 쿼리 이동도 깊이에 반영하세요.
useTrackAppHistoryDepth의 dependency가pathname뿐이라 동일 pathname에서 query만 변경하는router.push()도currentDepth와 히스토리 스탬프가 갱신되지 않습니다. 이후 깊이 0 화면에서backWithFallback()을 호출하면back()대신 fallbackreplace()가 실행될 수 있습니다.path와searchParams를 포함한 route key를 추적하세요.🤖 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 `@apps/web/src/hooks/useBackWithFallback.ts` around lines 23 - 42, Update the history-depth effect in useTrackAppHistoryDepth to track a route key composed of both pathname and searchParams, so query-only router.push() navigation also recalculates currentDepth and updates the history stamp. Use that combined route key as the effect dependency while preserving the existing depth and history-length logic.
🤖 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.
Nitpick comments:
In `@apps/web/src/hooks/useBackWithFallback.ts`:
- Around line 23-42: Update the history-depth effect in useTrackAppHistoryDepth
to track a route key composed of both pathname and searchParams, so query-only
router.push() navigation also recalculates currentDepth and updates the history
stamp. Use that combined route key as the effect dependency while preserving the
existing depth and history-length logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d86f4ca8-d213-4d6c-ab22-1593557cd336
📒 Files selected for processing (15)
apps/web/src/app/archive/wish/[id]/_hooks/useDeleteWish.tsapps/web/src/app/archive/wish/[id]/_hooks/usePatchWish.tsapps/web/src/app/archive/wish/[id]/_hooks/usePostWishRefresh.tsapps/web/src/app/tournament/[id]/_common/_hooks/useDeleteTournamentItem.tsapps/web/src/app/tournament/[id]/create/_components/TournamentCreateClient.tsxapps/web/src/app/tournament/[id]/create/_components/tournament-header/TournamentHeader.tsxapps/web/src/app/tournament/[id]/create/_hooks/usePostTournamentStart.tsapps/web/src/app/tournament/[id]/create/by-wish/_hooks/usePostTournamentItemsByWish.tsapps/web/src/app/tournament/[id]/item/[itemId]/_hooks/usePatchTournamentItem.tsapps/web/src/app/tournament/[id]/loading/page.tsxapps/web/src/app/tournament/[id]/match/_hooks/useTournament.tsapps/web/src/app/tournament/[id]/result/group/_components/GroupResultClient.tsxapps/web/src/app/tournament/join/[id]/_components/JoinPreviewClient.tsxapps/web/src/components/Providers.tsxapps/web/src/hooks/useBackWithFallback.ts
🚧 Files skipped from review as they are similar to previous changes (13)
- apps/web/src/app/tournament/[id]/match/_hooks/useTournament.ts
- apps/web/src/app/archive/wish/[id]/_hooks/usePatchWish.ts
- apps/web/src/app/archive/wish/[id]/_hooks/useDeleteWish.ts
- apps/web/src/app/tournament/[id]/loading/page.tsx
- apps/web/src/app/tournament/[id]/_common/_hooks/useDeleteTournamentItem.ts
- apps/web/src/app/archive/wish/[id]/_hooks/usePostWishRefresh.ts
- apps/web/src/app/tournament/[id]/create/_hooks/usePostTournamentStart.ts
- apps/web/src/app/tournament/join/[id]/_components/JoinPreviewClient.tsx
- apps/web/src/app/tournament/[id]/create/_components/TournamentCreateClient.tsx
- apps/web/src/app/tournament/[id]/create/by-wish/_hooks/usePostTournamentItemsByWish.ts
- apps/web/src/app/tournament/[id]/create/_components/tournament-header/TournamentHeader.tsx
- apps/web/src/app/tournament/[id]/item/[itemId]/_hooks/usePatchTournamentItem.ts
- apps/web/src/app/tournament/[id]/result/group/_components/GroupResultClient.tsx
…or-hook # Conflicts: # apps/web/src/app/archive/wish/[id]/_hooks/useDeleteWish.ts # apps/web/src/app/archive/wish/[id]/_hooks/usePatchWish.ts # apps/web/src/app/tournament/[id]/_common/_hooks/useDeleteTournamentItem.ts # apps/web/src/app/tournament/[id]/create/by-wish/_hooks/usePostTournamentItemsByWish.ts # apps/web/src/app/tournament/[id]/item/[itemId]/_hooks/usePatchTournamentItem.ts # apps/web/src/app/tournament/[id]/match/_hooks/useTournament.ts
작업 요약
수정한 케이스
원인과 해결
대부분 되돌아갈 이유가 없는 일회성 화면을
push로 쌓거나, 허브 화면으로 복귀할 때replace를 써서 같은 화면이 연속 두 번 남은 것이 원인이었음.replace로 히스토리에서 제거back()으로 통일 (기존usePatchTournamentItem과 동일한 방식)TournamentHeader는handleExit하나로 통합hasFriends는 확인 모달 노출 여부만 결정useBackWithFallback훅 추가router.back()은 히스토리가 없으면 앱 밖으로 나가버림.돌아갈 곳이 없을 때 지정한 경로로 대신 이동하는 훅을 추가하고, 위시 수정·삭제·새로고침, 그룹 결과, 아이템 수정, 담기 화면 나가기에 적용
참고
back()으로 바뀌면서?action=scroll-to-last쿼리를 쓸 수 없어, "마지막 바구니로 스크롤" 신호를 sessionStorage 플래그로 전달 (알림 딥링크가 쓰는 기존 쿼리 액션 경로는 그대로 유지)관련 이슈
Summary by CodeRabbit
새로운 기능
버그 수정