fix: 에러 페이지 및 갈등 유형 공유 페이지 개선 - #141
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedAn error occurred during the review process. Please try again later. 📝 WalkthroughWalkthrough분쟁 타입 응답에 Changes분쟁 타입 공개 응답과 화면 배치
Kakao 공유와 결과 공유 문구
로컬 설정 무시 규칙
Sequence Diagram(s)sequenceDiagram
participant JudgmentTypeResult
participant KakaoUtil
participant WindowKakao
JudgmentTypeResult->>KakaoUtil: shareDisputeResult(disputeId, title, description, imageUrl)
KakaoUtil->>WindowKakao: init(NEXT_PUBLIC_KAKAO_JAVASCRIPT_KEY)
KakaoUtil->>WindowKakao: Share.sendDefault(feed payload)
WindowKakao-->>JudgmentTypeResult: 공유 완료
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 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 unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@src/app/`(page)/disputes/[id]/page.tsx:
- Line 295: In the className ternary operator on line 295, the condition
checking for judgmentSubTab === 'type' to apply styles.contentType is missing a
check for the activeTab state. Currently, when isCompleted is true and
judgmentSubTab is 'type', the styles.contentType layout is applied regardless of
which tab (activeTab) is actually being viewed, causing the type-specific layout
to leak into non-type tabs like statement. Add an additional condition to verify
that activeTab is set to the appropriate tab (likely 'judgment' based on the
context) alongside the judgmentSubTab === 'type' check, so that
styles.contentType only applies when both conditions are met and the type layout
does not leak to other tabs.
🪄 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 (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 37b17086-c237-4b5e-bd0b-18f27f160a37
📒 Files selected for processing (6)
src/app/(page)/disputes/[id]/DisputePage.module.scsssrc/app/(page)/disputes/[id]/page.tsxsrc/app/(page)/disputes/[id]/type/ConflictTypeClient.tsxsrc/app/(page)/disputes/[id]/type/TypePage.module.scsssrc/app/(page)/disputes/[id]/type/page.tsxsrc/app/api/disputes/[id]/conflict-type/route.ts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 `@src/lib/utils/kakaoShare.ts`:
- Around line 20-21: The default title and description strings in the kakaoShare
function do not adhere to the required 4 writing categories (연애, 가족, 친구, 직장).
Replace the current default values for the title and description properties to
use content that falls strictly within one of these allowed categories instead
of the generic "갈등 판결" reference, ensuring the default share message complies
with the coding guidelines for permitted writing categories.
- Line 14: The shareUrl construction in the kakaoShare.ts file does not encode
the disputeId parameter, which can cause the URL to break when special
characters are present in the disputeId. Wrap the disputeId variable with proper
URL encoding using JavaScript's built-in encoding function when constructing the
shareUrl on the line where it's appended to the baseUrl and path. This ensures
that any special characters in the disputeId are properly escaped and the
resulting URL remains valid.
- Line 7: The current guard on line 7 only checks for window.Kakao but fails to
first verify that the window object itself exists, which causes a reference
error in server-side or Node.js contexts. Add a guard check for the window
object existence before accessing window.Kakao by checking if typeof window is
not undefined, ensuring the code handles both browser and server environments
safely.
- Around line 9-11: The Kakao SDK initialization in the code lacks validation
for the environment variable process.env.NEXT_PUBLIC_KAKAO_JAVASCRIPT_KEY before
passing it to window.Kakao.init(). Add a check to ensure that the
NEXT_PUBLIC_KAKAO_JAVASCRIPT_KEY environment variable is defined and not empty
before attempting to initialize the SDK. If the key is missing or invalid,
handle the error appropriately by either logging a meaningful error message or
throwing an exception to prevent silent failures during initialization.
🪄 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 (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: d2f2da0a-43b7-4729-8e73-9a3bcd731bed
⛔ Files ignored due to path filters (2)
package-lock.jsonis excluded by!**/package-lock.jsonpublic/images/characters/character-error.svgis excluded by!**/*.svg
📒 Files selected for processing (7)
.gitignoresrc/app/(page)/disputes/[id]/DisputePage.module.scsssrc/app/(page)/disputes/[id]/page.tsxsrc/app/(page)/disputes/[id]/type/page.tsxsrc/components/judgement/JudgmentTypeResult.tsxsrc/lib/utils/kakaoShare.tssrc/types/kakao.d.ts
✅ Files skipped from review due to trivial changes (3)
- src/components/judgement/JudgmentTypeResult.tsx
- src/types/kakao.d.ts
- .gitignore
🚧 Files skipped from review as they are similar to previous changes (3)
- src/app/(page)/disputes/[id]/type/page.tsx
- src/app/(page)/disputes/[id]/page.tsx
- src/app/(page)/disputes/[id]/DisputePage.module.scss
| title: title ?? '갈등 판결 결과를 확인해보세요!', | ||
| description: description ?? '나의 갈등 상황, AI가 판단했어요. 당신은 어떻게 생각하나요?', |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
기본 공유 문구를 허용된 4개 카테고리 기준으로 바꿔주세요.
Line 20-21 문구는 현재 카테고리 제한 규칙을 충족하지 않습니다. 허용 범위(연애/가족/친구/직장) 안에서 기본 title/description을 재작성해 주세요.
As per coding guidelines "**/*.{ts,tsx}: Use only 4 writing categories: 연애, 가족, 친구, 직장. Do not use: 관계, 금전, 공간, 시간, 가치관, 역할".
🤖 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/lib/utils/kakaoShare.ts` around lines 20 - 21, The default title and
description strings in the kakaoShare function do not adhere to the required 4
writing categories (연애, 가족, 친구, 직장). Replace the current default values for the
title and description properties to use content that falls strictly within one
of these allowed categories instead of the generic "갈등 판결" reference, ensuring
the default share message complies with the coding guidelines for permitted
writing categories.
Source: Coding guidelines
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/judgement/JudgmentTypeResult.tsx (1)
64-77: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win공유 취소 시 이미지가 새 탭으로 열리는 의도치 않은 폴백.
navigator.share({ files })는 사용자가 공유를 취소하면AbortError를 던집니다. 현재 구조에서는 이 예외가 line 75의catch로 전파되어window.open(cardImageUrl, '_blank')가 실행되므로, 단순 취소가 이미지 새 탭 열림으로 이어집니다.handleShare에서는 취소를 빈catch로 무시하는 것과 동작이 일관되지 않습니다. 취소(AbortError)는 별도로 무시하는 것을 고려하세요.🛠 제안 수정
if (navigator.canShare?.({ files: [file] })) { - await navigator.share({ files: [file] }) - return + try { + await navigator.share({ files: [file] }) + } catch (e) { + if ((e as Error)?.name === 'AbortError') return + throw e + } + return }🤖 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/components/judgement/JudgmentTypeResult.tsx` around lines 64 - 77, The shared-image fallback in JudgmentTypeResult’s share handler is incorrectly triggered when the user cancels the native share sheet, because `navigator.share` throws `AbortError` and the current `catch` always falls back to `window.open`. Update the share flow in `handleShare`/the related share logic to detect and ignore `AbortError` separately, while still allowing real failures to use the existing object-URL download or `window.open(cardImageUrl, '_blank')` fallback.
🤖 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 `@src/app/`(page)/disputes/[id]/type/ConflictTypeClient.tsx:
- Around line 33-35: The share flow in ConflictTypeClient’s handle file-sharing
logic treats user-cancelled navigator.share as an error, which causes the
fallback window.open path to run unnecessarily. Update the share handling around
navigator.share so that AbortError is recognized as a normal cancellation and
returns without opening a new tab, while preserving window.open only for real
share failures and the existing fallback cases.
In `@src/components/judgement/JudgmentTypeResult.tsx`:
- Around line 58-67: Add an explicit fetch success check in JudgmentTypeResult
before converting the response to a blob, since the current share flow can wrap
404/500 error bodies as files. In the same async handler where cardImageUrl is
fetched, mirror the guard used by ConflictTypeClient.handleDownload by verifying
res.ok and throwing an error when it is false, then only proceed to res.blob(),
File creation, and navigator.share. This keeps the sharing behavior consistent
with the download flow and prevents invalid responses from being shared.
---
Outside diff comments:
In `@src/components/judgement/JudgmentTypeResult.tsx`:
- Around line 64-77: The shared-image fallback in JudgmentTypeResult’s share
handler is incorrectly triggered when the user cancels the native share sheet,
because `navigator.share` throws `AbortError` and the current `catch` always
falls back to `window.open`. Update the share flow in `handleShare`/the related
share logic to detect and ignore `AbortError` separately, while still allowing
real failures to use the existing object-URL download or
`window.open(cardImageUrl, '_blank')` fallback.
🪄 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 (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 35687378-7c6e-4e7f-8b01-9921df259e5d
📒 Files selected for processing (2)
src/app/(page)/disputes/[id]/type/ConflictTypeClient.tsxsrc/components/judgement/JudgmentTypeResult.tsx
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
error.tsx,global-error.tsx) 뒤로가기 버튼에 히스토리 없을 시 홈(/) 이동 폴백 추가/disputes/[id]/type) 비로그인 접근 시 공유자(role_a) 이름 표시Header컴포넌트로 교체JudgmentTypeResult) 하단 과도한 여백 제거Test plan
/)으로 이동 확인OO님의 갈등 유형은?표시 확인🤖 Generated with Claude Code
Summary by CodeRabbit
릴리스 노트