Skip to content

Commit

Permalink
fix: bug when unable to see new loaded items on the All Courses screen
Browse files Browse the repository at this point in the history
  • Loading branch information
dixidroid committed Jul 29, 2024
1 parent 6efdd76 commit 869b765
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.GridItemSpan
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.foundation.lazy.grid.rememberLazyGridState
Expand Down Expand Up @@ -328,7 +329,7 @@ private fun AllEnrolledCoursesView(
}
)
}
item {
item(span = { GridItemSpan(columns) }) {
if (state.canLoadMore) {
Box(
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class AllEnrolledCoursesViewModel(
}
coursesList.clear()
coursesList.addAll(response.courses)
_uiState.update { it.copy(courses = coursesList) }
_uiState.update { it.copy(courses = coursesList.toList()) }
} catch (e: Exception) {
if (e.isInternetError()) {
_uiMessage.emit(UIMessage.SnackBarMessage(resourceManager.getString(R.string.core_error_no_connection)))
Expand Down Expand Up @@ -125,7 +125,7 @@ class AllEnrolledCoursesViewModel(
page = -1
coursesList.addAll(cachedList)
}
_uiState.update { it.copy(courses = coursesList) }
_uiState.update { it.copy(courses = coursesList.toList()) }
} catch (e: Exception) {
if (e.isInternetError()) {
_uiMessage.emit(UIMessage.SnackBarMessage(resourceManager.getString(R.string.core_error_no_connection)))
Expand Down

0 comments on commit 869b765

Please sign in to comment.