Skip to content

Commit

Permalink
refactor: Collect distinct loadstates to minimise churn
Browse files Browse the repository at this point in the history
  • Loading branch information
nikclayton committed Jan 24, 2025
1 parent 9d83970 commit 3975dcd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class NotificationsFragment :
}

// Update the UI from the loadState
adapter.loadStateFlow.collect { loadState ->
adapter.loadStateFlow.distinctUntilChangedBy { it.refresh }.collect { loadState ->
when (loadState.refresh) {
is LoadState.Error -> {
binding.progressIndicator.hide()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class TimelineFragment :
}
}

adapter.loadStateFlow.collect { loadState ->
adapter.loadStateFlow.distinctUntilChangedBy { it.refresh }.collect { loadState ->
when (loadState.refresh) {
is LoadState.Error -> {
binding.progressIndicator.hide()
Expand Down

0 comments on commit 3975dcd

Please sign in to comment.