[#486] TodayViewModel 생성 및 생명주기를 개선한다#496
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
이번 PR에서는 TodayView가 화면에 나타날 때 (.onAppear) 데이터를 로드하던 기존 방식을 MainView에서 탭 변경 (selectedTab)을 감지하여 TodayViewCoordinator를 통해 데이터를 가져오는 방식으로 변경하였습니다. 이에 따라 TodayViewModel 내의 액션명이 .onAppear에서 .fetchData로 수정되었습니다. 리뷰에서는 .onChange(of: selectedTab)가 값이 변경될 때만 트리거되어 앱이 처음 실행될 때 초기 탭에 대한 데이터 로드가 누락될 수 있는 문제를 지적하였으며, initial: true 옵션을 추가하는 개선 방안을 제안하였습니다.
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.
🔗 연관된 이슈
🎯 의도
Today 화면의 데이터 fetch가 View의
onAppear생명주기에 직접 연결되어 있어 화면 재구성 시점에 따라 불필요하게 호출될 수 있는 구조 개선📝 작업 내용
📌 요약
Today 데이터 fetch 트리거를
TodayView.onAppear에서MainView의 탭 선택 상태 변경 기준으로 이동🔍 상세
TodayView의onAppear기반 fetch 트리거 제거TodayViewModel.Action.onAppear를 실제 동작 의미에 맞는fetchData로 변경TodayViewCoordinator.fetchData()를 추가해 MainView가 TodayViewModel 액션을 직접 호출하지 않도록 조정MainView의selectedTab변경 감지에서 Today 탭 선택 시todayViewCoordinator.fetchData()호출📸 영상 / 이미지 (Optional)
2026-05-26.9.06.38.mov
2026-05-26.9.39.30.mov