fix: 온보딩 월간 캘린더 진입 날짜 수정#427
Conversation
개요홈 화면의 변경 사항HomeCalendarTap 컴포넌트 제거
온보딩 날짜 선택 초기화 로직 개선
예상 코드 리뷰 난이도🎯 2 (간단함) | ⏱️ ~10분 관련 PR
제안 리뷰어
🐰 축하 시
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 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 |
|
MATEBALL-STORYBOOK |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/pages/onboarding/components/date-select.tsx (1)
27-29: ⚡ Quick win
entryDate를 컴포넌트 본문에서 렌더마다 재생성하지 말고 마운트 시에만 고정하세요.React 공식 문서에 따르면 함수형 컴포넌트 본문의 모든 코드는 매 렌더링마다 실행됩니다. 현재
const entryDate = new Date();는 매 렌더링마다 새로운 Date 객체를 생성하므로,MonthCalendar의entryDateprop이 초기 진입 시점과 달라질 수 있습니다. 진입 당일을 기준으로 유지하려면 마운트 시에 한 번만 고정해야 합니다.수정 예시
-import { useState } from 'react'; +import { useRef, useState } from 'react'; - const entryDate = new Date(); + const entryDateRef = useRef(new Date()); + const entryDate = entryDateRef.current;🤖 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/pages/onboarding/components/date-select.tsx` around lines 27 - 29, entryDate is being recreated on every render; fix by creating a stable initial date during mount (e.g., useMemo/useRef/useState initializer) and use that single value for selectedDate, currentMonth and MonthCalendar's entryDate prop so the "entry day" stays constant across renders; update references to the new stable identifier (entryDate or initialEntryDate) in the useState initializers for selectedDate and currentMonth and in the MonthCalendar prop.
🤖 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 `@src/pages/onboarding/components/date-select.tsx`:
- Around line 27-29: entryDate is being recreated on every render; fix by
creating a stable initial date during mount (e.g., useMemo/useRef/useState
initializer) and use that single value for selectedDate, currentMonth and
MonthCalendar's entryDate prop so the "entry day" stays constant across renders;
update references to the new stable identifier (entryDate or initialEntryDate)
in the useState initializers for selectedDate and currentMonth and in the
MonthCalendar prop.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 2ef3dbc8-0d53-45c9-96c4-acdfa3bf724f
📒 Files selected for processing (2)
src/pages/home/components/home-calendar-tap.tsxsrc/pages/onboarding/components/date-select.tsx
💤 Files with no reviewable changes (1)
- src/pages/home/components/home-calendar-tap.tsx
#️⃣ Related Issue
Closes #426
☀️ New-insight
💎 PR Point
온보딩 날짜 선택 단계에서 여전히 진입일 기준 이틀 후 날짜가 디폴트 값으로 설정되어 있어 수정했습니다.
더이상 사용되지 않는 파일 제거했습니다.
📸 Screenshot
Summary by CodeRabbit
릴리스 노트