스터디 수정 시 썸네일 이미지 유지 및 유효성 검증 로직 수정#559
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 Walkthrough개요그룹 스터디 폼의 썸네일 확장자 처리 로직을 강화했습니다. 편집 모드에서 썸네일 URL 존재 여부를 확인하는 조건을 추가하고, 썸네일 확장자 파싱을 더 엄격하게 개선했으며, 편집 폼 초기화를 일회성으로 제어하는 참조 변수를 도입했습니다. 변경 사항
예상 코드 리뷰 소요 시간🎯 3 (Moderate) | ⏱️ ~20분 관련 가능성 있는 PR
시 (Poem)
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsTimed out fetching pipeline failures after 30000ms 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/group-study/forms/group-study-form.tsx (1)
128-153:⚠️ Potential issue | 🟠 Major편집 모드에서
thumbnailUrl변경 시 다음 버튼 비활성화 상태가 반영되지 않습니다.라인 130의
methods.getValues('thumbnailUrl')는 스냅샷만 반환하고 필드 변경을 구독하지 않습니다.STEP_FIELDS[2]는thumbnailExtension,title,description,summary만 포함하므로, 편집 모드에서 사용자가thumbnailUrl만 변경하면isNextButtonDisabled메모가 재계산되지 않아 검증 상태가 stale 상태로 남습니다.useWatch로thumbnailUrl을 구독하여 의존성에 추가해야 합니다.수정 예시
const currentStepFields = STEP_FIELDS[step]; const currentStepValues = useWatch({ name: currentStepFields, control }); + const thumbnailUrl = useWatch({ name: 'thumbnailUrl', control }); const isNextButtonDisabled = useMemo(() => { return currentStepFields.some((field, index) => { const value = currentStepValues[index]; const error = formState.errors[field]; @@ if (field === 'thumbnailExtension') { if (mode === 'edit') { - const existingUrl = methods.getValues('thumbnailUrl'); - return (!value || value === 'DEFAULT') && !existingUrl; + return (!value || value === 'DEFAULT') && !thumbnailUrl; } return !value || value === 'DEFAULT'; } @@ }, [ currentStepFields, currentStepValues, formState.errors, classification, - methods, mode, + thumbnailUrl, ]);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/group-study/forms/group-study-form.tsx` around lines 128 - 153, The disable-next-button logic uses methods.getValues('thumbnailUrl') which returns a snapshot and doesn't trigger re-evaluation when thumbnailUrl changes; replace that snapshot usage by subscribing to thumbnailUrl with useWatch (e.g., const thumbnailUrl = useWatch({ name: 'thumbnailUrl', control: methods.control })) and include thumbnailUrl in the dependency array for the memo/calculation that sets isNextButtonDisabled (the block referencing thumbnailExtension, interviewPost, methods.getValues, currentStepFields, currentStepValues, formState.errors, classification, mode), so edits to thumbnailUrl in edit mode correctly re-run validation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/components/group-study/forms/group-study-form.tsx`:
- Around line 128-153: The disable-next-button logic uses
methods.getValues('thumbnailUrl') which returns a snapshot and doesn't trigger
re-evaluation when thumbnailUrl changes; replace that snapshot usage by
subscribing to thumbnailUrl with useWatch (e.g., const thumbnailUrl = useWatch({
name: 'thumbnailUrl', control: methods.control })) and include thumbnailUrl in
the dependency array for the memo/calculation that sets isNextButtonDisabled
(the block referencing thumbnailExtension, interviewPost, methods.getValues,
currentStepFields, currentStepValues, formState.errors, classification, mode),
so edits to thumbnailUrl in edit mode correctly re-run validation.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ca2fe974-878f-4c31-9780-9f1b97a82e30
📒 Files selected for processing (2)
src/components/group-study/forms/group-study-form.tsxsrc/components/group-study/modals/group-study-form-modal.tsx
🌱 연관된 이슈
☘️ 작업 내용
🍀 참고사항
스크린샷 (선택)
Summary by CodeRabbit
릴리스 노트