Skip to content

feat: SP2 history state에 날짜 정보 저장 - #439

Merged
bongtta merged 3 commits into
developfrom
feat/#438/save-date
Jul 15, 2026
Merged

feat: SP2 history state에 날짜 정보 저장#439
bongtta merged 3 commits into
developfrom
feat/#438/save-date

Conversation

@bongtta

@bongtta bongtta commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

#️⃣ Related Issue

Closes #438

☀️ New-insight

처음에는 선택한 날짜를 URL Query Parameter로 관리하려고 했지만 구현하면서 고려해야 할 경우의 수가 예상보다 많았다.

  • 기존 쿼리 파라미터와의 충돌 가능성
  • 페이지마다 다른 URL 구조 관리
  • 뒤로가기 및 직접 진입 시 예외 처리
  • 불필요하게 URL이 길어지고 상태 관리가 복잡해지는 문제

이번 기능은 이전 화면으로 돌아왔을 때 선택했던 날짜만 유지하면 되는 요구사항이었기 때문에 URL을 변경하는 방식보다 history state를 활용해 화면 상태를 전달하는 방식이 목적에 더 적합하다고 판단했다.

이를 통해 필요한 화면 상태만 유지하면서 URL은 그대로 유지할 수 있었고, 불필요한 예외 처리도 줄일 수 있었다.

💎 PR Point

  • 선택한 날짜 정보를 history state에 저장하도록 변경
  • 뒤로가기 시 이전에 선택했던 날짜가 그대로 유지되도록 수정
  • URL Query Parameter를 사용하는 대신 화면 전환 시 필요한 상태만 전달하도록 개선
  • 헤더 로고 이동 및 뒤로가기 등 주요 이동 흐름에서도 날짜 정보가 유지되도록 반영

📸 Screenshot

2026-07-16.5.03.17.mov

Summary by CodeRabbit

  • 개선 사항
    • 홈 캘린더 상태를 페이지 간 일관되게 유지하도록 개선했습니다.
    • 홈 진입 및 매칭 설정 상태에 따른 화면 동작을 정리했습니다.
    • 매칭 완료 후 토스트가 표시된 뒤 상태가 중복 처리되지 않도록 개선했습니다.
    • 로고 클릭 시 홈 화면으로 새로 이동하도록 변경했습니다.
    • 게임 카드의 “메이트 만나기” 버튼 여백과 레이아웃을 조정했습니다.

@bongtta bongtta self-assigned this Jul 15, 2026
@bongtta
bongtta requested a review from heesunee as a code owner July 15, 2026 20:05
@bongtta bongtta added feat new feature 채은 labels Jul 15, 2026
@bongtta bongtta linked an issue Jul 15, 2026 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Layout Outlet 컨텍스트에 홈 캘린더 상태를 추가하고 Home의 날짜 변경·토스트 처리 흐름을 컨텍스트 기반으로 전환했습니다. 헤더 로고 이동 방식과 게임 카드 버튼 스타일도 함께 조정했습니다.

Changes

홈 캘린더 상태 공유

Layer / File(s) Summary
Outlet 컨텍스트 계약 및 상태 초기화
src/shared/routes/layout.tsx, src/pages/game/game.tsx
HomeCalendarStateLayoutOutletContext를 추가하고, Layout에서 날짜 기반 캘린더 상태를 초기화해 하위 라우트에 전달합니다.
Home 날짜 및 토스트 상태 흐름
src/pages/home/home.tsx
Home이 Outlet 컨텍스트의 캘린더 상태를 사용하며, 날짜 변경은 setHomeCalendarState로 처리합니다. match-created 토스트 표시 후 navigation state를 초기화합니다.
헤더 및 게임 카드 동작 정리
src/shared/components/header/utils/get-header.tsx, src/pages/game/components/game-card.tsx
헤더 로고를 전체 페이지 이동으로 변경하고, 게임 카드 버튼의 높이·패딩 클래스를 조정합니다.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Layout
  participant Home
  participant CalendarSection
  Layout->>Home: homeCalendarState 제공
  Home->>CalendarSection: selectedDate와 handleDateChange 전달
  CalendarSection->>Home: 날짜 변경 이벤트 전달
  Home->>Layout: setHomeCalendarState 호출
Loading

Possibly related PRs

Suggested labels: 소은

Suggested reviewers: heesunee

Poem

깡충 뛰는 토끼가 날짜를 골라
달력 상태를 레이아웃에 맡겨요
토스트는 살짝 인사하고 사라지고
로고는 집으로 힘차게 달려가요
버튼 패딩도 포근해졌답니다 🐰

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning 게임 카드 버튼 스타일 변경처럼 날짜 저장과 직접 관련 없는 수정이 포함되어 있습니다. 날짜 저장과 무관한 UI/스타일 변경은 별도 PR로 분리하거나 이 PR에서 제거하세요.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목이 날짜 정보를 history state에 저장한다는 핵심 변경을 정확히 요약합니다.
Linked Issues check ✅ Passed 선택한 날짜를 history state에 저장하도록 홈/레이아웃 컨텍스트를 개편해 #438의 요구를 충족합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/#438/save-date

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: private package registry requires authentication. Disable ESLint in CodeRabbit settings or use public packages.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

MATEBALL-STORYBOOK
⚾ Storybook 배포가 완료되었습니다!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
src/pages/home/home.tsx (1)

33-38: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

entryDate가 렌더링마다 새로 생성됨.

entryDate = new Date()가 컴포넌트 바디에서 매 렌더링마다 실행되어 매번 다른 Date 참조가 CalendarSectionentryDate prop으로 전달됩니다. homeCalendarState 변경(날짜 선택 등)으로 Home이 리렌더될 때마다 값도 새로 계산되어, 하위 컴포넌트의 참조 동일성 기반 최적화(memo 등)를 무력화시킬 수 있고 불필요한 연산이 반복됩니다. Layout의 초기 homeCalendarState 설정 시 사용된 "entry" 시점 날짜와도 개념적으로 분리되어 있어, 마운트 시점에 한 번만 고정하는 편이 의미상으로도 더 안전합니다.

♻️ 제안
-  const entryDate = new Date();
+  const [entryDate] = useState(() => new Date());
🤖 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/home/home.tsx` around lines 33 - 38, Update the entryDate
initialization in the Home component to capture the current date only once for
the component’s lifetime, preserving the initial entry-time value across
re-renders caused by homeCalendarState changes. Continue passing this stable
value to CalendarSection.
src/shared/routes/layout.tsx (2)

49-70: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

LGTM (동작 자체는 문제 없음), 다만 위 코멘트와 동일한 결합도 우려.

초기화 로직(lazy initializer, addDays 사용)과 Outlet context 전달 자체는 정확합니다. 다만 이 블록은 Home 전용 상태를 모든 하위 라우트에 무조건 전달하는 지점으로, Line 14-24 코멘트에서 제안한 구조 분리와 함께 개선하는 것을 권장합니다.

🤖 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/shared/routes/layout.tsx` around lines 49 - 70, Separate the
Home-specific calendar state initialization and Outlet context from the shared
layout path, following the structure proposed for the related block around the
layout state. Keep the lazy initializer using addDays and preserve the existing
HomeCalendarState values, but expose this context only to Home routes rather
than unconditionally to every child route.

14-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Layout가 Home 전용 캘린더 상태 계약까지 소유하게 됨.

Layout은 헤더/푸터/로딩 등 앱 셸 역할을 담당하는 라우트인데, 이번 변경으로 Home 도메인에 특화된 HomeCalendarState/LayoutOutletContext를 직접 정의하고 모든 하위 라우트(Game, Result, Onboarding 등)에 강제로 전달하게 됩니다. Home 외 라우트는 homeCalendarState/setHomeCalendarState를 전혀 사용하지 않으므로, 향후 캘린더 관련 상태가 늘어날수록 Layout이 계속 비대해질 위험이 있습니다.

별도의 캘린더 상태 훅/컨텍스트로 분리해 Layout은 조합만 담당하도록 하는 편이 유지보수에 유리합니다.

♻️ 참고용 구조 예시
// src/pages/home/hooks/use-home-calendar-state.ts
export const useHomeCalendarState = () => {
  const [state, setState] = useState<HomeCalendarState>(() => {
    const entryDate = new Date();
    return { selectedDate: entryDate, baseWeekDate: addDays(entryDate, WEEK_CALENDAR_START_OFFSET) };
  });
  return { homeCalendarState: state, setHomeCalendarState: setState };
};
🤖 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/shared/routes/layout.tsx` around lines 14 - 24, LayoutOutletContext가 Home
전용 캘린더 상태까지 소유하지 않도록 HomeCalendarState와 관련 상태 관리 로직을 별도의 Home 캘린더 훅 또는 컨텍스트로
이동하세요. Layout은 기존 셸 상태와 해당 캘린더 제공 구성을 조합하는 역할만 담당하고, Game·Result·Onboarding 등
Home 외 라우트에는 homeCalendarState와 setHomeCalendarState를 강제 전달하지 않도록
LayoutOutletContext 및 하위 라우트 연결을 조정하세요.
🤖 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/pages/home/home.tsx`:
- Around line 63-79: Update the navigation inside the useEffect to preserve the
current URL query string by including location.search with location.pathname;
also retain location.hash if present, while keeping the existing replace and
state-reset behavior unchanged.

---

Nitpick comments:
In `@src/pages/home/home.tsx`:
- Around line 33-38: Update the entryDate initialization in the Home component
to capture the current date only once for the component’s lifetime, preserving
the initial entry-time value across re-renders caused by homeCalendarState
changes. Continue passing this stable value to CalendarSection.

In `@src/shared/routes/layout.tsx`:
- Around line 49-70: Separate the Home-specific calendar state initialization
and Outlet context from the shared layout path, following the structure proposed
for the related block around the layout state. Keep the lazy initializer using
addDays and preserve the existing HomeCalendarState values, but expose this
context only to Home routes rather than unconditionally to every child route.
- Around line 14-24: LayoutOutletContext가 Home 전용 캘린더 상태까지 소유하지 않도록
HomeCalendarState와 관련 상태 관리 로직을 별도의 Home 캘린더 훅 또는 컨텍스트로 이동하세요. Layout은 기존 셸 상태와
해당 캘린더 제공 구성을 조합하는 역할만 담당하고, Game·Result·Onboarding 등 Home 외 라우트에는
homeCalendarState와 setHomeCalendarState를 강제 전달하지 않도록 LayoutOutletContext 및 하위
라우트 연결을 조정하세요.
🪄 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

Run ID: 4d9dc035-996a-4c8b-bfea-6c6b58908f23

📥 Commits

Reviewing files that changed from the base of the PR and between e1c8eac and 2097dcd.

📒 Files selected for processing (5)
  • src/pages/game/components/game-card.tsx
  • src/pages/game/game.tsx
  • src/pages/home/home.tsx
  • src/shared/components/header/utils/get-header.tsx
  • src/shared/routes/layout.tsx

@MATEBALL MATEBALL deleted a comment from coderabbitai Bot Jul 15, 2026
@bongtta
bongtta merged commit 5c7d4a4 into develop Jul 15, 2026
5 checks passed
@bongtta
bongtta deleted the feat/#438/save-date branch July 15, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat new feature 채은

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: 날짜 정보를 history state에 저장합니다.

1 participant