Skip to content

[#441] Home 초기 데이터 로드 시점을 화면 생명주기에서 선택 상태 기준으로 변경한다#492

Merged
opficdev merged 5 commits into
developfrom
refactor/#441-HomeViewModel
May 22, 2026
Merged

[#441] Home 초기 데이터 로드 시점을 화면 생명주기에서 선택 상태 기준으로 변경한다#492
opficdev merged 5 commits into
developfrom
refactor/#441-HomeViewModel

Conversation

@opficdev
Copy link
Copy Markdown
Owner

🔗 연관된 이슈

🎯 의도

  • HomeView 생명주기에 묶여 있던 초기 데이터 로드 트리거를 상위 선택 상태 기준으로 이동하여 compact/regular UI 재구성에 따른 중복 네트워크 요청 방지

📝 작업 내용

📌 요약

  • Home 초기 데이터 로드 시점을 MainView의 탭 선택 상태 변화로 이동
  • HomeViewonAppear 기반 fetch 제거
  • HomeViewCoordinator를 통한 초기 로드 호출 경로 정리
  • 관련 테스트 호출 액션 정리

🔍 상세

  • RootViewselectedMainTabMainTab?로 변경하여 로그인 성공 시 nil -> .home 전이를 초기 로드 기준으로 사용
  • MainView에서 selectedTab 변경 시 oldValue == nil && newValue == .home 조건으로만 Home 초기 데이터 로드 호출
  • HomeViewModel의 초기 로드 액션을 loadInitialData로 변경하여 역할 명확화
  • HomeView에서 직접 onAppear로 초기 fetch를 보내던 흐름 제거
  • HomeViewCoordinator에 초기 로드 전달 메서드 추가로 MainViewHomeViewModel을 직접 알지 않도록 정리
  • DeleteWebPageTests의 초기 로드 호출 액션을 변경된 흐름에 맞게 수정

📸 영상 / 이미지 (Optional)

@opficdev opficdev self-assigned this May 22, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors tab management by making the selected tab optional and moving data loading logic from HomeView to MainView. Feedback highlights that moving the main view's onAppear action into an onChange block causes unnecessary repeated calls. Additionally, the condition for loading initial home data is identified as too restrictive, potentially causing data to fail to load when switching tabs, and removing the nil check in the sidebar binding may result in an empty UI state.

Comment thread Application/DevLogPresentation/Sources/Main/MainView.swift Outdated
Comment thread Application/DevLogPresentation/Sources/Main/MainView.swift
@opficdev opficdev merged commit d2fa031 into develop May 22, 2026
1 check passed
@opficdev opficdev deleted the refactor/#441-HomeViewModel branch May 22, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HomeViewModel 생성 및 생명주기를 개선한다

1 participant