Skip to content

Commit 20c29a6

Browse files
author
Manuel Vivo
authored
Fix bookmarking scrolling to top of the page bug (#548)
1 parent 71e98d8 commit 20c29a6

File tree

1 file changed

+2
-6
lines changed
  • feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou

1 file changed

+2
-6
lines changed

feature/foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouViewModel.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import kotlinx.coroutines.flow.combine
3232
import kotlinx.coroutines.flow.flatMapLatest
3333
import kotlinx.coroutines.flow.flowOf
3434
import kotlinx.coroutines.flow.map
35-
import kotlinx.coroutines.flow.onStart
3635
import kotlinx.coroutines.flow.stateIn
3736
import kotlinx.coroutines.launch
3837
import javax.inject.Inject
@@ -68,7 +67,8 @@ class ForYouViewModel @Inject constructor(
6867
} else {
6968
getSaveableNewsResources(
7069
filterTopicIds = userData.followedTopics,
71-
).mapToFeedState()
70+
)
71+
.map<List<UserNewsResource>, NewsFeedUiState>(NewsFeedUiState::Success)
7272
}
7373
}
7474
// Flatten the feed flows.
@@ -116,7 +116,3 @@ class ForYouViewModel @Inject constructor(
116116
}
117117
}
118118
}
119-
120-
private fun Flow<List<UserNewsResource>>.mapToFeedState(): Flow<NewsFeedUiState> =
121-
map<List<UserNewsResource>, NewsFeedUiState>(NewsFeedUiState::Success)
122-
.onStart { emit(NewsFeedUiState.Loading) }

0 commit comments

Comments
 (0)