Skip to content

Commit

Permalink
fix: non-paginated conversation list is not loading [WPB-15066]
Browse files Browse the repository at this point in the history
  • Loading branch information
saleniuk committed Dec 16, 2024
1 parent d37cf33 commit e67aff9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ internal fun NavController.navigateToItem(command: NavigationCommand) {

fun lastDestinationFromOtherGraph(graph: NavGraphSpec) = currentBackStack.value.lastOrNull { it.navGraph() != graph }

appLogger.d("[$TAG] -> command: ${command.destination.route.obfuscateId()}")
appLogger.d("[$TAG] -> command: ${command.destination.route.obfuscateId()} backStackMode:${command.backStackMode}")
navigate(command.destination) {
when (command.backStackMode) {
BackStackMode.CLEAR_WHOLE, BackStackMode.CLEAR_TILL_START -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,13 @@ class ConversationListViewModelImpl @AssistedInject constructor(
.flowOn(dispatcher.io())
.cachedIn(viewModelScope)

private var notPaginatedConversationListState by mutableStateOf(ConversationListState.NotPaginated())
override val conversationListState: ConversationListState =
if (usePagination) {
ConversationListState.Paginated(
conversations = conversationsPaginatedFlow,
domain = currentAccount.domain
)
} else {
notPaginatedConversationListState
override var conversationListState by mutableStateOf(
when (usePagination) {
true -> ConversationListState.Paginated(conversations = conversationsPaginatedFlow, domain = currentAccount.domain)
false -> ConversationListState.NotPaginated()
}
)
private set

init {
if (!usePagination) {
Expand Down Expand Up @@ -258,7 +255,7 @@ class ConversationListViewModelImpl @AssistedInject constructor(
}
.flowOn(dispatcher.io())
.collect {
notPaginatedConversationListState = notPaginatedConversationListState.copy(
conversationListState = ConversationListState.NotPaginated(
isLoading = false,
conversations = it,
domain = currentAccount.domain
Expand Down

0 comments on commit e67aff9

Please sign in to comment.