From b6cd2f60e3ec0069042e5fb77274e276370d5e5f Mon Sep 17 00:00:00 2001 From: opficdev Date: Tue, 26 May 2026 21:12:48 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20Today=20=EB=8D=B0=EC=9D=B4=ED=84=B0?= =?UTF-8?q?=20fetch=20=EC=8B=9C=EC=A0=90=EC=9D=84=20=ED=83=AD=20=EC=84=A0?= =?UTF-8?q?=ED=83=9D=20=EC=83=81=ED=83=9C=20=EA=B8=B0=EC=A4=80=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/DevLogPresentation/Sources/Main/MainView.swift | 2 ++ .../DevLogPresentation/Sources/Today/TodayView.swift | 1 - .../Sources/Today/TodayViewCoordinator.swift | 4 ++++ .../DevLogPresentation/Sources/Today/TodayViewModel.swift | 6 +++--- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Application/DevLogPresentation/Sources/Main/MainView.swift b/Application/DevLogPresentation/Sources/Main/MainView.swift index b9dc7471..ea33e54b 100644 --- a/Application/DevLogPresentation/Sources/Main/MainView.swift +++ b/Application/DevLogPresentation/Sources/Main/MainView.swift @@ -44,6 +44,8 @@ struct MainView: View { .onChange(of: selectedTab) { _, newValue in if newValue == .home { homeViewCoordinator.loadInitialData() + } else if newValue == .today { + todayViewCoordinator.fetchData() } } .alert( diff --git a/Application/DevLogPresentation/Sources/Today/TodayView.swift b/Application/DevLogPresentation/Sources/Today/TodayView.swift index 7fded289..7db59ef9 100644 --- a/Application/DevLogPresentation/Sources/Today/TodayView.swift +++ b/Application/DevLogPresentation/Sources/Today/TodayView.swift @@ -29,7 +29,6 @@ struct TodayView: View { .toolbar { toolbarContent } .background(NavigationBarConfigurator()) .refreshable { coordinator.viewModel.send(.refresh) } - .onAppear { coordinator.viewModel.send(.onAppear) } .alert( coordinator.viewModel.state.alertTitle, isPresented: Binding( diff --git a/Application/DevLogPresentation/Sources/Today/TodayViewCoordinator.swift b/Application/DevLogPresentation/Sources/Today/TodayViewCoordinator.swift index 46bc2578..290bb0d3 100644 --- a/Application/DevLogPresentation/Sources/Today/TodayViewCoordinator.swift +++ b/Application/DevLogPresentation/Sources/Today/TodayViewCoordinator.swift @@ -24,4 +24,8 @@ final class TodayViewCoordinator { updateTodayDisplayOptionsUseCase: container.resolve(UpdateTodayDisplayOptionsUseCase.self) ) } + + func fetchData() { + viewModel.send(.fetchData) + } } diff --git a/Application/DevLogPresentation/Sources/Today/TodayViewModel.swift b/Application/DevLogPresentation/Sources/Today/TodayViewModel.swift index 0002fdcc..0281bfbb 100644 --- a/Application/DevLogPresentation/Sources/Today/TodayViewModel.swift +++ b/Application/DevLogPresentation/Sources/Today/TodayViewModel.swift @@ -62,7 +62,7 @@ final class TodayViewModel: Store { case resetDisplayOptions case completeTodo(TodayTodoItem) case togglePinned(TodayTodoItem) - case onAppear + case fetchData case fetchTodos([TodayTodoItem]) case setLoading(Bool) case updateTodo(TodayTodoItem) @@ -178,7 +178,7 @@ final class TodayViewModel: Store { case .refresh, .setAlert, .setSectionScope, .setDueDateVisibility, .setFocusVisibility, .resetDisplayOptions, .completeTodo, .togglePinned: effects = reduceByUser(action, state: &state) - case .onAppear: + case .fetchData: effects = reduceByView(action, state: &state) case .fetchTodos, .setLoading, .updateTodo, .removeTodo: effects = reduceByRun(action, state: &state) @@ -305,7 +305,7 @@ private extension TodayViewModel { func reduceByView(_ action: Action, state: inout State) -> [SideEffect] { switch action { - case .onAppear: + case .fetchData: return [.fetchTodos] default: break From c0a2ace95f950ebc7ed3a15bae2cf64e778f851d Mon Sep 17 00:00:00 2001 From: opficdev Date: Tue, 26 May 2026 21:51:14 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=EC=B4=88=EA=B8=B0=20=ED=83=AD=20?= =?UTF-8?q?=EC=84=A0=ED=83=9D=20=EC=83=81=ED=83=9C=EC=9D=98=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20fetch=20=EB=88=84=EB=9D=BD=20=EB=B0=A9?= =?UTF-8?q?=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/DevLogPresentation/Sources/Main/MainView.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/DevLogPresentation/Sources/Main/MainView.swift b/Application/DevLogPresentation/Sources/Main/MainView.swift index ea33e54b..856cd414 100644 --- a/Application/DevLogPresentation/Sources/Main/MainView.swift +++ b/Application/DevLogPresentation/Sources/Main/MainView.swift @@ -41,7 +41,7 @@ struct MainView: View { .onAppear { coordinator.mainViewModel.send(.onAppear) } - .onChange(of: selectedTab) { _, newValue in + .onChange(of: selectedTab, initial: true) { _, newValue in if newValue == .home { homeViewCoordinator.loadInitialData() } else if newValue == .today { From 4285d7a079581dbf36c271f28fb62c06b64b51ea Mon Sep 17 00:00:00 2001 From: opficdev Date: Tue, 26 May 2026 21:53:16 +0900 Subject: [PATCH 3/3] =?UTF-8?q?refactor:=20Home=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20fetch=20=EC=95=A1=EC=85=98=EB=AA=85=20=EC=A0=95?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/Home/Home/HomeViewCoordinator.swift | 4 ++-- .../Sources/Home/Home/HomeViewModel.swift | 6 +++--- Application/DevLogPresentation/Sources/Main/MainView.swift | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Application/DevLogPresentation/Sources/Home/Home/HomeViewCoordinator.swift b/Application/DevLogPresentation/Sources/Home/Home/HomeViewCoordinator.swift index 477d4d44..0eafabc7 100644 --- a/Application/DevLogPresentation/Sources/Home/Home/HomeViewCoordinator.swift +++ b/Application/DevLogPresentation/Sources/Home/Home/HomeViewCoordinator.swift @@ -45,8 +45,8 @@ final class HomeViewCoordinator { ) } - func loadInitialData() { - viewModel.send(.loadInitialData) + func fetchData() { + viewModel.send(.fetchData) } func makeTodoManageViewModel() -> TodoManageViewModel { diff --git a/Application/DevLogPresentation/Sources/Home/Home/HomeViewModel.swift b/Application/DevLogPresentation/Sources/Home/Home/HomeViewModel.swift index 11cb785b..dbda9812 100644 --- a/Application/DevLogPresentation/Sources/Home/Home/HomeViewModel.swift +++ b/Application/DevLogPresentation/Sources/Home/Home/HomeViewModel.swift @@ -38,7 +38,7 @@ final class HomeViewModel: Store { } enum Action { - case loadInitialData + case fetchData case networkStatusChanged(Bool) case setPresentation(Presentation, Bool) case setAlert(isPresented: Bool, type: AlertType? = nil) @@ -145,7 +145,7 @@ final class HomeViewModel: Store { switch action { case .networkStatusChanged(let isConnected): state.isNetworkConnected = isConnected - case .loadInitialData, .setPresentation, .setAlert, .setToast, .refreshWebPages, + case .fetchData, .setPresentation, .setAlert, .setToast, .refreshWebPages, .tapTodoCategory, .orderTodoCategory, .addTodo, .updateWebPageURLInput, .addWebPage, .deleteWebPage, .undoDeleteWebPage: effects = reduceByView(action, state: &state) @@ -274,7 +274,7 @@ private extension HomeViewModel { // swiftlint:disable cyclomatic_complexity func reduceByView(_ action: Action, state: inout State) -> [SideEffect] { switch action { - case .loadInitialData: + case .fetchData: return [.fetchTodoCategoryPreferences, .fetchRecentTodos, .fetchWebPages] case .refreshWebPages: return [.fetchWebPages] diff --git a/Application/DevLogPresentation/Sources/Main/MainView.swift b/Application/DevLogPresentation/Sources/Main/MainView.swift index 856cd414..ecc6d36b 100644 --- a/Application/DevLogPresentation/Sources/Main/MainView.swift +++ b/Application/DevLogPresentation/Sources/Main/MainView.swift @@ -43,7 +43,7 @@ struct MainView: View { } .onChange(of: selectedTab, initial: true) { _, newValue in if newValue == .home { - homeViewCoordinator.loadInitialData() + homeViewCoordinator.fetchData() } else if newValue == .today { todayViewCoordinator.fetchData() }