From 238d410245ee51c90a1e668cd2ab6b1d6a9be51b Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Mon, 28 Nov 2022 11:53:12 +0000 Subject: [PATCH] Revert "fix: cache pager flows in ViewModel scope" Trying to see if this fixes anything This reverts commit 6b05a2991d75061267d38947683d71b81948c9df. --- .../msfjarvis/claw/android/viewmodel/ClawViewModel.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/android/src/main/kotlin/dev/msfjarvis/claw/android/viewmodel/ClawViewModel.kt b/android/src/main/kotlin/dev/msfjarvis/claw/android/viewmodel/ClawViewModel.kt index b2532e65..2ca3f21e 100644 --- a/android/src/main/kotlin/dev/msfjarvis/claw/android/viewmodel/ClawViewModel.kt +++ b/android/src/main/kotlin/dev/msfjarvis/claw/android/viewmodel/ClawViewModel.kt @@ -10,7 +10,6 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import androidx.paging.Pager import androidx.paging.PagingConfig -import androidx.paging.cachedIn import com.deliveryhero.whetstone.viewmodel.ContributesViewModel import com.slack.eithernet.ApiResult.Failure import com.slack.eithernet.ApiResult.Success @@ -41,19 +40,19 @@ constructor( private var hottestPostsPagingSource: LobstersPagingSource? = null private var newestPostsPagingSource: LobstersPagingSource? = null private val hottestPostsPager = - Pager(PagingConfig(pageSize = 20)) { + Pager(PagingConfig(20)) { pagingSourceFactory.create(api::getHottestPosts).also { hottestPostsPagingSource = it } } private val newestPostsPager = - Pager(PagingConfig(pageSize = 20)) { + Pager(PagingConfig(20)) { pagingSourceFactory.create(api::getHottestPosts).also { newestPostsPagingSource = it } } val hottestPosts - get() = hottestPostsPager.flow.cachedIn(viewModelScope) + get() = hottestPostsPager.flow val newestPosts - get() = newestPostsPager.flow.cachedIn(viewModelScope) + get() = newestPostsPager.flow private val savedPostsFlow get() = savedPostsRepository.savedPosts