[#441] Home 초기 데이터 로드 시점을 화면 생명주기에서 선택 상태 기준으로 변경한다#492
Merged
Conversation
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 연관된 이슈
🎯 의도
HomeView생명주기에 묶여 있던 초기 데이터 로드 트리거를 상위 선택 상태 기준으로 이동하여 compact/regular UI 재구성에 따른 중복 네트워크 요청 방지📝 작업 내용
📌 요약
MainView의 탭 선택 상태 변화로 이동HomeView의onAppear기반 fetch 제거HomeViewCoordinator를 통한 초기 로드 호출 경로 정리🔍 상세
RootView의selectedMainTab을MainTab?로 변경하여 로그인 성공 시nil -> .home전이를 초기 로드 기준으로 사용MainView에서selectedTab변경 시oldValue == nil && newValue == .home조건으로만 Home 초기 데이터 로드 호출HomeViewModel의 초기 로드 액션을loadInitialData로 변경하여 역할 명확화HomeView에서 직접onAppear로 초기 fetch를 보내던 흐름 제거HomeViewCoordinator에 초기 로드 전달 메서드 추가로MainView가HomeViewModel을 직접 알지 않도록 정리DeleteWebPageTests의 초기 로드 호출 액션을 변경된 흐름에 맞게 수정📸 영상 / 이미지 (Optional)