From c069412cd36e80d3963a8d67ef8c5d56d10d18b8 Mon Sep 17 00:00:00 2001 From: Irfan Omur Date: Sat, 2 Mar 2024 17:04:14 +0300 Subject: [PATCH] Send LOADING to the UI model of stats screen if the state is loading --- .../android/ui/stats/refresh/lists/UiModelMapper.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/UiModelMapper.kt b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/UiModelMapper.kt index d1fd0bcd541a..4eefe9cab16c 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/UiModelMapper.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/UiModelMapper.kt @@ -99,6 +99,10 @@ class UiModelMapper if (useCaseModels.isNotEmpty()) { UiModel.Success(useCaseModels.mapNotNull { useCaseModel -> when { + useCaseModel.state == LOADING -> useCaseModel.stateData?.let { + StatsBlock.Loading(useCaseModel.type, useCaseModel.stateData) + } + useCaseModel.type == overViewType && useCaseModel.data != null -> StatsBlock.Success( useCaseModel.type, useCaseModel.data @@ -109,10 +113,6 @@ class UiModelMapper useCaseModel.data ?: listOf() ) - useCaseModel.state == LOADING -> useCaseModel.stateData?.let { - StatsBlock.Loading(useCaseModel.type, useCaseModel.stateData) - } - useCaseModel.state == ERROR -> useCaseModel.stateData?.let { StatsBlock.Error(useCaseModel.type, useCaseModel.stateData) }