From bb6c4a0fa5337ff44766c822afa2cc248e4c9911 Mon Sep 17 00:00:00 2001 From: Ivan Stepanok Date: Fri, 15 Sep 2023 11:34:11 +0300 Subject: [PATCH] minor fixes --- Discovery/Discovery/Presentation/DiscoveryView.swift | 3 --- Discovery/Discovery/Presentation/DiscoveryViewModel.swift | 2 ++ .../Discussion/Presentation/Comments/Thread/ThreadView.swift | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Discovery/Discovery/Presentation/DiscoveryView.swift b/Discovery/Discovery/Presentation/DiscoveryView.swift index 2aab73fcf..e8f6f52d4 100644 --- a/Discovery/Discovery/Presentation/DiscoveryView.swift +++ b/Discovery/Discovery/Presentation/DiscoveryView.swift @@ -123,9 +123,6 @@ public struct DiscoveryView: View { OfflineSnackBarView( connectivity: viewModel.connectivity, reloadAction: { - viewModel.courses = [] - viewModel.totalPages = 1 - viewModel.nextPage = 1 await viewModel.discovery(page: 1, withProgress: false) }) diff --git a/Discovery/Discovery/Presentation/DiscoveryViewModel.swift b/Discovery/Discovery/Presentation/DiscoveryViewModel.swift index 08a588191..37514275b 100644 --- a/Discovery/Discovery/Presentation/DiscoveryViewModel.swift +++ b/Discovery/Discovery/Presentation/DiscoveryViewModel.swift @@ -62,6 +62,8 @@ public class DiscoveryViewModel: ObservableObject { if connectivity.isInternetAvaliable { if page == 1 { await courses = try interactor.discovery(page: page) + self.totalPages = 1 + self.nextPage = 1 } else { await courses += try interactor.discovery(page: page) } diff --git a/Discussion/Discussion/Presentation/Comments/Thread/ThreadView.swift b/Discussion/Discussion/Presentation/Comments/Thread/ThreadView.swift index de192751d..7bbbdae0a 100644 --- a/Discussion/Discussion/Presentation/Comments/Thread/ThreadView.swift +++ b/Discussion/Discussion/Presentation/Comments/Thread/ThreadView.swift @@ -141,7 +141,6 @@ public struct ThreadView: View { viewModel.sendUpdateUnreadState() } } onRefresh: { -// viewModel.comments = [] Task { _ = await viewModel.getPosts(thread: thread, page: 1) }